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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Aug 12 14:46:57 CEST 2010


Revision: 52036
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52036&view=rev
Author:   fingolfin
Date:     2010-08-12 12:46:57 +0000 (Thu, 12 Aug 2010)

Log Message:
-----------
DECOMPILER: Add 'pos' parameter to processSpecialMetadata

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
    tools/branches/gsoc2010-decompiler/decompiler/codegen.h
    tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp
    tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.cpp	2010-08-12 12:46:57 UTC (rev 52036)
@@ -355,7 +355,7 @@
 					bool returnsValue = (it->_codeGenData.find("r") == 0);
 					std::string metadata = (!returnsValue ? it->_codeGenData : it->_codeGenData.substr(1));
 					for (size_t i = 0; i < metadata.length(); i++)
-						processSpecialMetadata(*it, metadata[i]);
+						processSpecialMetadata(*it, metadata[i], i);
 					_stack.push(new CallEntry(it->_name, _argList));
 					if (!returnsValue) {
 						std::stringstream stream;
@@ -386,7 +386,7 @@
 		_argList.push_back(p);
 }
 
-void CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
+void CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
 	switch (c) {
 		case 'p':
 			addArg(_stack.pop());

Modified: tools/branches/gsoc2010-decompiler/decompiler/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/codegen.h	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/codegen.h	2010-08-12 12:46:57 UTC (rev 52036)
@@ -414,8 +414,9 @@
 	 *
 	 * @param inst The instruction being processed.
 	 * @param c The character signifying the action to be taken.
+	 * @param pos The position at which c occurred in the metadata.
 	 */
-	virtual void processSpecialMetadata(const Instruction inst, char c);
+	virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
 
 	/**
 	 * Add an argument to the argument list.

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.cpp	2010-08-12 12:46:57 UTC (rev 52036)
@@ -141,7 +141,7 @@
 			_argList.clear();
 			Function f = _engine->_functions.find(inst._params[0].getUnsigned())->second;
 			for (size_t i = 0; i < f._metadata.length(); i++)
-				processSpecialMetadata(inst, f._metadata[i]);
+				processSpecialMetadata(inst, f._metadata[i], i);
 			_stack.push(new CallEntry(f._name, _argList));
 			// Leave call on stack if this is a condition, or other calls follow in same group
 			if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
@@ -164,7 +164,7 @@
 			bool returnsValue = (inst._codeGenData.find("r") == 1);
 			std::string metadata = (!returnsValue ? inst._codeGenData.substr(1) : inst._codeGenData.substr(2));
 			for (size_t i = 0; i < metadata.length(); i++)
-				processSpecialMetadata(inst, metadata[i]);
+				processSpecialMetadata(inst, metadata[i], i);
 			_stack.push(new CallEntry(inst._name, _argList));
 			// Leave call on stack if this is a condition, or other calls follow in same group
 			if (_curGroup->_type == kIfCond || _curGroup->_type == kWhileCond || _curGroup->_type == kDoWhileCond || inst._address != findLastCall()._address) {
@@ -209,7 +209,7 @@
 	return *_curGroup->_end;
 }
 
-void Kyra::Kyra2CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
+void Kyra::Kyra2CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
 	switch (c) {
 	case '0':
 		_stackOffset = 0;
@@ -231,7 +231,7 @@
 		}
 		break;
 	default:
-		CodeGenerator::processSpecialMetadata(inst, c);
+		CodeGenerator::processSpecialMetadata(inst, c, pos);
 		break;
 	}
 }

Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/codegen.h	2010-08-12 12:46:57 UTC (rev 52036)
@@ -61,7 +61,7 @@
 	Kyra2CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kLIFO, kLIFO) {}
 protected:
 	void processInst(const Instruction inst);
-	virtual void processSpecialMetadata(const Instruction inst, char c);
+	virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
 	std::string constructFuncSignature(const Function &func);
 };
 

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.cpp	2010-08-12 12:46:57 UTC (rev 52036)
@@ -423,7 +423,7 @@
 	return s.str();
 }
 
-void Scumm::v6::Scummv6CodeGenerator::processSpecialMetadata(const Instruction inst, char c) {
+void Scumm::v6::Scummv6CodeGenerator::processSpecialMetadata(const Instruction &inst, char c, int pos) {
 	switch (c) {
 	// All of these meanings are taken from descumm.
 	case 'l':
@@ -458,7 +458,7 @@
 		addArg(_stack.pop());
 		break;
 	default:
-		CodeGenerator::processSpecialMetadata(inst, c);
+		CodeGenerator::processSpecialMetadata(inst, c, pos);
 		break;
 	}
 }

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h	2010-08-12 12:35:46 UTC (rev 52035)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h	2010-08-12 12:46:57 UTC (rev 52036)
@@ -74,7 +74,7 @@
 	Scummv6CodeGenerator(Engine *engine, std::ostream &output) : CodeGenerator(engine, output, kFIFO, kFIFO) {}
 protected:
 	void processInst(const Instruction inst);
-	virtual void processSpecialMetadata(const Instruction inst, char c);
+	virtual void processSpecialMetadata(const Instruction &inst, char c, int pos);
 };
 
 } // End of namespace v6


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