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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Aug 12 13:23:33 CEST 2010


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

Log Message:
-----------
DECOMPILER: Add convenience constructors for Parameter & Instruction

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

Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-08-12 09:52:00 UTC (rev 52031)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-08-12 11:23:32 UTC (rev 52032)
@@ -69,6 +69,10 @@
 	ParamType _type;                                   ///< Type of the parameter.
 	boost::variant<int32, uint32, std::string> _value; ///< Value of the parameter.
 
+	Parameter() {}
+	Parameter(ParamType type, boost::variant<int32, uint32, std::string> value)
+		: _type(type), _value(value) {}
+
 	/**
 	 * Gets an int32 stored in the _value variant.
 	 *
@@ -100,12 +104,16 @@
 struct Instruction {
 	uint32 _opcode;                 ///< The instruction opcode.
 	uint32 _address;                ///< The instruction address.
-	int16 _stackChange;             ///< How much this instruction changes the stack pointer by.
 	std::string _name;              ///< The instruction name (opcode name).
 	InstType _type;                 ///< The instruction type.
+	int16 _stackChange;             ///< How much this instruction changes the stack pointer by.
 	std::vector<Parameter> _params; ///< Array of parameters used for the instruction.
 	std::string _codeGenData;       ///< String containing metadata for code generation. Start with 0xC0 to force custom handling. See the extended documentation for details.
 
+	Instruction(uint32 opcode = 0, uint32 address = 0,
+			std::string name = "", InstType type = kSpecial, int16 stackChange = 0) :
+		_opcode(opcode), _address(address), _name(name), _type(type), _stackChange(stackChange) {}
+
 	/**
 	 * Operator overload to output a vector to a std::ostream.
 	 *


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