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

pidgeot at users.sourceforge.net pidgeot at users.sourceforge.net
Sat Jun 12 23:45:46 CEST 2010


Revision: 49612
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49612&view=rev
Author:   pidgeot
Date:     2010-06-12 21:45:46 +0000 (Sat, 12 Jun 2010)

Log Message:
-----------
Formatting fixes, missing Doxygen comments and exception specifications

Modified Paths:
--------------
    tools/branches/gsoc2010-decompiler/decompiler/disassembler.h
    tools/branches/gsoc2010-decompiler/decompiler/engine.h
    tools/branches/gsoc2010-decompiler/decompiler/instruction.h
    tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.h
    tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h
    tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.cpp
    tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.h
    tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.cpp
    tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.h

Modified: tools/branches/gsoc2010-decompiler/decompiler/disassembler.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/disassembler.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/disassembler.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -40,12 +40,13 @@
 	Common::File _f;                 ///< Used to perform file I/O.
 	std::vector<Instruction> _insts; ///< Container for disassembled instructions.
 	uint32 _addressBase;             ///< Base address where the script starts.
-	bool _disassemblyDone;            ///< Indicates whether or not disassembly has already been performed.
+	bool _disassemblyDone;           ///< Indicates whether or not disassembly has already been performed.
 
 	/**
 	 * Performs disassembly.
+	 * @throws UnknownOpcodeException on unknown opcode.
 	 */
-	virtual void doDisassemble() = 0;
+	virtual void doDisassemble() throw(UnknownOpcodeException) = 0;
 
 	/**
 	 * Outputs the disassembled code.

Modified: tools/branches/gsoc2010-decompiler/decompiler/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/engine.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/engine.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -25,10 +25,17 @@
 
 #include "disassembler.h"
 
+/**
+ * Base class for engines.
+ */
 class Engine {
 public:
 	virtual ~Engine() {}
 
+	/**
+	 * Retrieve the disassembler for the engine.
+	 * @return Pointer to a Disassembler for the engine.
+	 */
 	virtual Disassembler *getDisassembler() const = 0;
 };
 

Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -68,8 +68,25 @@
 	ParamType _type;                                   ///< Type of the parameter.
 	boost::variant<int32, uint32, std::string> _value; ///< Value of the parameter.
 
+	/**
+	 * Gets an int32 stored in the _value variant.
+	 * @return The int32 stored in the _value variant.
+	 * @throws boost::bad_get if the variant is not storing an int32.
+	 */
 	int32 getSigned() const { return boost::get<int32>(_value); }
+
+	/**
+	 * Gets an uint32 stored in the _value variant.
+	 * @return The uint32 stored in the _value variant.
+	 * @throws boost::bad_get if the variant is not storing an uint32.
+	 */
 	uint32 getUnsigned() const { return boost::get<uint32>(_value); }
+
+	/**
+	 * Gets an std::string stored in the _value variant.
+	 * @return The std::string stored in the _value variant.
+	 * @throws boost::bad_get if the variant is not storing an std::string.
+	 */
 	std::string getString() const { return boost::get<std::string>(_value); }
 };
 

Modified: tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/objectFactory.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -43,9 +43,9 @@
 class ObjectFactory {
 private:
 
-	typedef BaseType *(*CreateFunc)(); ///<Function pointer to the object creation function.
-	typedef std::map<std::string, CreateFunc> RegistryMap;
-	RegistryMap _registry; ///<Map from an identifier to a creation function.
+	typedef BaseType *(*CreateFunc)();                     ///<Function pointer to the object creation function.
+	typedef std::map<std::string, CreateFunc> RegistryMap; ///<Type used to store registered entries.
+	RegistryMap _registry;                                 ///<Map from an identifier to a creation function.
 
 public:
 	/**

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.cpp	2010-06-12 21:45:46 UTC (rev 49612)
@@ -25,7 +25,7 @@
 
 #include "disassembler.h"
 
-void Scumm::v6::Disassembler::doDisassemble() {
+void Scumm::v6::Disassembler::doDisassemble() throw(UnknownOpcodeException) {
 	std::string blockName;
 	for (int i = 0; i < 4; i++) {
 		blockName += _f.readChar();
@@ -435,9 +435,8 @@
 }
 
 void Scumm::v6::Disassembler::readParameter(Parameter *p, char type) {
-	switch (type)	{
-	case 'c': //Character string
-		{
+	switch (type) {
+	case 'c': { //Character string
 		byte cmd;
 		bool inStr = false;
 		std::stringstream s;
@@ -464,8 +463,7 @@
 				case 4:		// addIntToStack
 				case 5:		// addVerbToStack
 				case 6:		// addNameToStack
-				case 7:		// addStringToStack
-					{
+				case 7: {	// addStringToStack
 					uint16 var = _f.readUint16LE();
 					//TODO: Clean output similar to descumm
 					s << ":addToStack=" << var << ":";

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/disassembler.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -34,10 +34,17 @@
  */
 class Disassembler : public SimpleDisassembler {
 public:
-	void doDisassemble();
+	void doDisassemble() throw(UnknownOpcodeException);
 
 	void readParameter(Parameter *p, char type);
 
+	/**
+	 * Determines the actual stack effect of an opcode with a variable stack effect.
+	 * @param it Iterator pointing to the instruction to be fixed.
+	 * @param popBefore Number of pops prior to the variable-length list.
+	 * @param popAfter Number of pops after the variable-length list.
+	 * @param pushTotal Number of values pushed from the instruction.
+	 */
 	void fixStackEffect(InstIterator &it, int popBefore, int popAfter, int pushTotal);
 };
 

Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -29,6 +29,9 @@
 
 namespace v6 {
 
+/**
+ * SCUMMv6 engine.
+ */
 class Engine : public ::Engine {
 public:
 	::Disassembler *getDisassembler() const;

Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.cpp	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.cpp	2010-06-12 21:45:46 UTC (rev 49612)
@@ -22,7 +22,7 @@
 
 #include "pasc.h"
 
-void PasCDisassembler::doDisassemble() {
+void PasCDisassembler::doDisassemble() throw(UnknownOpcodeException) {
 	START_OPCODES;
 		//Basic machine operations
 		OPCODE(0x00, "PUSH", kStack, 0, "i");

Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/pasc.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -27,6 +27,6 @@
 
 class PasCDisassembler : public SimpleDisassembler {
 public:
-	virtual void doDisassemble();
+	void doDisassemble() throw(UnknownOpcodeException);
 };
 #endif

Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.cpp	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.cpp	2010-06-12 21:45:46 UTC (rev 49612)
@@ -22,7 +22,7 @@
 
 #include "subopcode.h"
 
-void SubOpcodeDisassembler::doDisassemble() {
+void SubOpcodeDisassembler::doDisassemble() throw(UnknownOpcodeException) {
 	START_OPCODES;
 		START_SUBOPCODE(0xFF)
 			OPCODE(0xFF, "FOO", kSpecial, 0, "");

Modified: tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.h	2010-06-12 21:43:50 UTC (rev 49611)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/disassembler/subopcode.h	2010-06-12 21:45:46 UTC (rev 49612)
@@ -27,6 +27,6 @@
 
 class SubOpcodeDisassembler : public SimpleDisassembler {
 public:
-	virtual void doDisassemble();
+	void doDisassemble() throw(UnknownOpcodeException);
 };
 #endif


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