[Scummvm-cvs-logs] SF.net SVN: scummvm:[54939] tools/branches/gsoc2010-decompiler/decompiler

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Fri Dec 17 01:22:47 CET 2010


Revision: 54939
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54939&view=rev
Author:   pidgeot
Date:     2010-12-17 00:22:47 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
DECOMPILER: Add copy function to Instruction

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/instruction.cpp
    tools/branches/gsoc2010-decompiler/decompiler/instruction.h
    tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp

Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.cpp	2010-12-17 00:14:51 UTC (rev 54938)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.cpp	2010-12-17 00:22:47 UTC (rev 54939)
@@ -70,6 +70,15 @@
 	throw WrongTypeException();
 }
 
+void Instruction::copy(InstPtr other) {
+	_opcode = other->_opcode;
+	_address = other->_address;
+	_stackChange = other->_stackChange;
+	_name = other->_name;
+	_codeGenData = other->_codeGenData;
+	_params = other->_params;
+}
+
 std::ostream &Instruction::print(std::ostream &output) const {
 	output << boost::format("%08x: %s") % _address % _name;
 	std::vector<ValuePtr>::const_iterator param;

Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-12-17 00:14:51 UTC (rev 54938)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-12-17 00:22:47 UTC (rev 54939)
@@ -178,6 +178,12 @@
 	 */
 	virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen) = 0;
 
+	/**
+	 * Copies base data from another instruction.
+	 *
+	 * @param other The instruction to copy from.
+	 */
+	void copy(InstPtr other);
 };
 
 /**

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-12-17 00:14:51 UTC (rev 54938)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/disassembler.cpp	2010-12-17 00:22:47 UTC (rev 54939)
@@ -593,12 +593,7 @@
 		if ((*it)->isJump()) {
 			if (lastWasPushPos || _engine->_functions.find((*it)->_params[0]->getUnsigned()) != _engine->_functions.end()) {
 				InstPtr p = _instFactory.create(kCallInst);
-				p->_opcode = (*it)->_opcode;
-				p->_address = (*it)->_address;
-				p->_stackChange = (*it)->_stackChange;
-				p->_name = (*it)->_name;
-				p->_codeGenData = (*it)->_codeGenData;
-				p->_params = (*it)->_params;
+				p->copy(*it);
 				*it = p;
 			}
 		}


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