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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Jun 28 14:28:46 CEST 2010


Revision: 50441
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50441&view=rev
Author:   fingolfin
Date:     2010-06-28 12:28:46 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
SCI: Move a few remaining Script methods to engine/script.cpp

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

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-06-28 12:28:29 UTC (rev 50440)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-06-28 12:28:46 UTC (rev 50441)
@@ -521,4 +521,63 @@
 	relocate(make_reg(segmentId, READ_SCI11ENDIAN_UINT16(_heapStart)));
 }
 
+reg_t Script::findCanonicAddress(SegManager *segMan, reg_t addr) const {
+	addr.offset = 0;
+	return addr;
+}
+
+void Script::freeAtAddress(SegManager *segMan, reg_t addr) {
+	/*
+		debugC(2, kDebugLevelGC, "[GC] Freeing script %04x:%04x", PRINT_REG(addr));
+		if (_localsSegment)
+			debugC(2, kDebugLevelGC, "[GC] Freeing locals %04x:0000", _localsSegment);
+	*/
+
+	if (_markedAsDeleted)
+		segMan->deallocateScript(_nr);
+}
+
+Common::Array<reg_t> Script::listAllDeallocatable(SegmentId segId) const {
+	const reg_t r = make_reg(segId, 0);
+	return Common::Array<reg_t>(&r, 1);
+}
+
+Common::Array<reg_t> Script::listAllOutgoingReferences(reg_t addr) const {
+	Common::Array<reg_t> tmp;
+	if (addr.offset <= _bufSize && addr.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(_buf + addr.offset)) {
+		const Object *obj = getObject(addr.offset);
+		if (obj) {
+			// Note all local variables, if we have a local variable environment
+			if (_localsSegment)
+				tmp.push_back(make_reg(_localsSegment, 0));
+
+			for (uint i = 0; i < obj->getVarCount(); i++)
+				tmp.push_back(obj->getVariable(i));
+		} else {
+			error("Request for outgoing script-object reference at %04x:%04x failed", PRINT_REG(addr));
+		}
+	} else {
+		/*		warning("Unexpected request for outgoing script-object references at %04x:%04x", PRINT_REG(addr));*/
+		/* Happens e.g. when we're looking into strings */
+	}
+	return tmp;
+}
+
+Common::Array<reg_t> Script::listObjectReferences() const {
+	Common::Array<reg_t> tmp;
+
+	// Locals, if present
+	if (_localsSegment)
+		tmp.push_back(make_reg(_localsSegment, 0));
+
+	// All objects (may be classes, may be indirectly reachable)
+	ObjMap::iterator it;
+	const ObjMap::iterator end = _objects.end();
+	for (it = _objects.begin(); it != end; ++it) {
+		tmp.push_back(it->_value.getPos());
+	}
+
+	return tmp;
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-28 12:28:29 UTC (rev 50440)
+++ scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-28 12:28:46 UTC (rev 50441)
@@ -245,66 +245,6 @@
 }
 
 
-//-------------------- script --------------------
-reg_t Script::findCanonicAddress(SegManager *segMan, reg_t addr) const {
-	addr.offset = 0;
-	return addr;
-}
-
-void Script::freeAtAddress(SegManager *segMan, reg_t addr) {
-	/*
-		debugC(2, kDebugLevelGC, "[GC] Freeing script %04x:%04x", PRINT_REG(addr));
-		if (_localsSegment)
-			debugC(2, kDebugLevelGC, "[GC] Freeing locals %04x:0000", _localsSegment);
-	*/
-
-	if (_markedAsDeleted)
-		segMan->deallocateScript(_nr);
-}
-
-Common::Array<reg_t> Script::listAllDeallocatable(SegmentId segId) const {
-	const reg_t r = make_reg(segId, 0);
-	return Common::Array<reg_t>(&r, 1);
-}
-
-Common::Array<reg_t> Script::listAllOutgoingReferences(reg_t addr) const {
-	Common::Array<reg_t> tmp;
-	if (addr.offset <= _bufSize && addr.offset >= -SCRIPT_OBJECT_MAGIC_OFFSET && RAW_IS_OBJECT(_buf + addr.offset)) {
-		const Object *obj = getObject(addr.offset);
-		if (obj) {
-			// Note all local variables, if we have a local variable environment
-			if (_localsSegment)
-				tmp.push_back(make_reg(_localsSegment, 0));
-
-			for (uint i = 0; i < obj->getVarCount(); i++)
-				tmp.push_back(obj->getVariable(i));
-		} else {
-			error("Request for outgoing script-object reference at %04x:%04x failed", PRINT_REG(addr));
-		}
-	} else {
-		/*		warning("Unexpected request for outgoing script-object references at %04x:%04x", PRINT_REG(addr));*/
-		/* Happens e.g. when we're looking into strings */
-	}
-	return tmp;
-}
-
-Common::Array<reg_t> Script::listObjectReferences() const {
-	Common::Array<reg_t> tmp;
-
-	// Locals, if present
-	if (_localsSegment)
-		tmp.push_back(make_reg(_localsSegment, 0));
-
-	// All objects (may be classes, may be indirectly reachable)
-	ObjMap::iterator it;
-	const ObjMap::iterator end = _objects.end();
-	for (it = _objects.begin(); it != end; ++it) {
-		tmp.push_back(it->_value.getPos());
-	}
-
-	return tmp;
-}
-
 //-------------------- clones --------------------
 
 Common::Array<reg_t> CloneTable::listAllOutgoingReferences(reg_t addr) const {


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