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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon May 18 17:07:31 CEST 2009


Revision: 40690
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40690&view=rev
Author:   fingolfin
Date:     2009-05-18 15:07:31 +0000 (Mon, 18 May 2009)

Log Message:
-----------
SCI: Removed ENTRY_IS_VALID macro

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/klists.cpp
    scummvm/trunk/engines/sci/engine/sciconsole.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/engine/seg_manager.cpp
    scummvm/trunk/engines/sci/engine/vm.h

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-05-18 15:07:31 UTC (rev 40690)
@@ -240,8 +240,8 @@
 byte *kmem(EngineState *s, reg_t handle) {
 	HunkTable *ht = (HunkTable *)GET_SEGMENT(*s->seg_manager, handle.segment, MEM_OBJ_HUNK);
 
-	if (!ht || !ENTRY_IS_VALID(ht, handle.offset)) {
-		error("Error: kmem() with invalid handle\n");
+	if (!ht || !ht->isValidEntry(handle.offset)) {
+		warning("Error: kmem() with invalid handle\n");
 		return NULL;
 	}
 
@@ -669,7 +669,7 @@
 			return KSIG_REF;
 
 	case MEM_OBJ_CLONES:
-		if (allow_invalid || ENTRY_IS_VALID((CloneTable *)mobj, reg.offset))
+		if (allow_invalid || ((CloneTable *)mobj)->isValidEntry(reg.offset))
 			return KSIG_OBJECT;
 		else
 			return KSIG_OBJECT | KSIG_INVALID;
@@ -694,13 +694,13 @@
 			return KSIG_REF | KSIG_INVALID;
 
 	case MEM_OBJ_LISTS:
-		if (allow_invalid || ENTRY_IS_VALID((ListTable *)mobj, reg.offset))
+		if (allow_invalid || ((ListTable *)mobj)->isValidEntry(reg.offset))
 			return KSIG_LIST;
 		else
 			return KSIG_LIST | KSIG_INVALID;
 
 	case MEM_OBJ_NODES:
-		if (allow_invalid || ENTRY_IS_VALID((NodeTable *)mobj, reg.offset))
+		if (allow_invalid || ((NodeTable *)mobj)->isValidEntry(reg.offset))
 			return KSIG_NODE;
 		else
 			return KSIG_NODE | KSIG_INVALID;

Modified: scummvm/trunk/engines/sci/engine/klists.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/klists.cpp	2009-05-18 15:07:31 UTC (rev 40690)
@@ -44,7 +44,7 @@
 
 	NodeTable *nt = (NodeTable *)mobj;
 
-	if (!ENTRY_IS_VALID(nt, addr.offset)) {
+	if (!nt->isValidEntry(addr.offset)) {
 		sciprintf("Attempt to use non-node "PREG" as list node\n", PRINT_REG(addr));
 		script_debug_flag = script_error_flag = 1;
 		return NULL;
@@ -64,7 +64,7 @@
 
 	ListTable *lt = (ListTable *)mobj;
 
-	if (!ENTRY_IS_VALID(lt, addr.offset)) {
+	if (!lt->isValidEntry(addr.offset)) {
 		sciprintf("Attempt to use non-list "PREG" as list\n", PRINT_REG(addr));
 		script_debug_flag = script_error_flag = 1;
 		return NULL;

Modified: scummvm/trunk/engines/sci/engine/sciconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/sciconsole.cpp	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/sciconsole.cpp	2009-05-18 15:07:31 UTC (rev 40690)
@@ -203,7 +203,7 @@
 }
 
 static inline int clone_is_used(CloneTable *t, int idx) {
-	return ENTRY_IS_VALID(t, idx);
+	return t->isValidEntry(idx);
 }
 
 int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on success

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-18 15:07:31 UTC (rev 40690)
@@ -354,15 +354,15 @@
 
 	while (!IS_NULL_REG(pos)) {
 		Node *node;
-		MemObject *mobj = GET_SEGMENT(*s->seg_manager, pos.segment, MEM_OBJ_NODES);
+		NodeTable *nt = (NodeTable *)GET_SEGMENT(*s->seg_manager, pos.segment, MEM_OBJ_NODES);
 
-		if (!mobj || !ENTRY_IS_VALID((NodeTable *)mobj, pos.offset)) {
+		if (!nt || !nt->isValidEntry(pos.offset)) {
 			sciprintf("   WARNING: "PREG": Doesn't contain list node!\n",
 			          PRINT_REG(pos));
 			return;
 		}
 
-		node = &((*(NodeTable *)mobj)._table[pos.offset]);
+		node = &(nt->_table[pos.offset]);
 
 		sciprintf("\t"PREG"  : "PREG" -> "PREG"\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value));
 
@@ -499,7 +499,7 @@
 		ListTable *lt = (ListTable *)mobj;
 		List *list;
 
-		if (!ENTRY_IS_VALID(lt, addr.offset)) {
+		if (!lt->isValidEntry(addr.offset)) {
 			sciprintf("Address does not contain a list\n");
 			return 1;
 		}
@@ -519,7 +519,7 @@
 
 		nt = (NodeTable *)mobj;
 
-		if (!ENTRY_IS_VALID(nt, addr.offset)) {
+		if (!nt->isValidEntry(addr.offset)) {
 			sciprintf("Address does not contain a node\n");
 			return 1;
 		}

Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp	2009-05-18 15:07:31 UTC (rev 40690)
@@ -1106,7 +1106,7 @@
 
 //	assert(addr.segment == _segId);
 
-	if (!(ENTRY_IS_VALID(clone_table, addr.offset))) {
+	if (!clone_table->isValidEntry(addr.offset)) {
 		fprintf(stderr, "Unexpected request for outgoing references from clone at "PREG"\n", PRINT_REG(addr));
 //		BREAKPOINT();
 		return;

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2009-05-18 15:07:04 UTC (rev 40689)
+++ scummvm/trunk/engines/sci/engine/vm.h	2009-05-18 15:07:31 UTC (rev 40690)
@@ -564,10 +564,7 @@
 //	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 };
 
-// FIXME: Replace ENTRY_IS_VALID by a direct method call
-#define ENTRY_IS_VALID(t, i) ((t)->isValidEntry(i))
 
-
 /* CloneTable */
 struct CloneTable : public Table<Clone> {
 	virtual void freeAtAddress(SegManager *segmgr, reg_t sub_addr);


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