[Scummvm-cvs-logs] SF.net SVN: scummvm:[54917] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Wed Dec 15 00:54:19 CET 2010
Revision: 54917
http://scummvm.svn.sourceforge.net/scummvm/?rev=54917&view=rev
Author: pidgeot
Date: 2010-12-14 23:54:17 +0000 (Tue, 14 Dec 2010)
Log Message:
-----------
DECOMPILER: Add missing Doxygen comments
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/instruction.h
tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h
tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h
tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h
tools/branches/gsoc2010-decompiler/decompiler/value.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/instruction.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-12-14 23:30:22 UTC (rev 54916)
+++ tools/branches/gsoc2010-decompiler/decompiler/instruction.h 2010-12-14 23:54:17 UTC (rev 54917)
@@ -52,10 +52,10 @@
const int kDupInst = 4; ///< Instruction duplicates the most recent stack entry.
const int kJumpInst = 5; ///< Unconditional jump.
const int kKernelCallInst = 6; ///< Kernel functions.
-const int kLoadInst = 7; ///< Load value to stack.
+const int kLoadInst = 7; ///< Load value from memory.
const int kReturnInst = 8; ///< Return from regular function call.
const int kStackInst = 9; ///< Stack allocation or deallocation (altering stack pointer)
-const int kStoreInst = 10; ///< Store value from stack in memory.
+const int kStoreInst = 10; ///< Store value in memory.
const int kUnaryOpPreInst = 11; ///< Unary operation (e.g. !) with operator placed before the operator.
const int kUnaryOpPostInst = 12; ///< Unary operation with operator placed after the operator.
@@ -80,10 +80,6 @@
std::vector<ValuePtr> _params; ///< Array of parameters used for the instruction.
std::string _codeGenData; ///< String containing metadata for code generation. See the extended documentation for details.
- Instruction(uint32 opcode = 0, uint32 address = 0,
- std::string name = "", int16 stackChange = 0) :
- _opcode(opcode), _address(address), _name(name), _stackChange(stackChange) {}
-
/**
* Operator overload to output an Instruction to a std::ostream.
*
@@ -95,90 +91,207 @@
return inst->print(output);
}
+ /**
+ * Print the instruction to an std::ostream.
+ *
+ * @param output The std::ostream to write to.
+ * @return The std::ostream used for output.
+ */
virtual std::ostream &print(std::ostream &output) const;
+ /**
+ * Returns whether or not the instruction is a jump of some sort.
+ *
+ * @return True if the instruction is a jump, otherwise false.
+ */
virtual bool isJump() const;
+
+ /**
+ * Returns whether or not the instruction is a conditional jump.
+ *
+ * @return True if the instruction is a conditional jump, otherwise false.
+ */
virtual bool isCondJump() const;
+
+ /**
+ * Returns whether or not the instruction is an unconditional jump.
+ *
+ * @return True if the instruction is an unconditional jump, otherwise false.
+ */
virtual bool isUncondJump() const;
+
+ /**
+ * Returns whether or not the instruction is a stack operation.
+ *
+ * @return True if the instruction is a stack operation, otherwise false.
+ */
virtual bool isStackOp() const;
+
+ /**
+ * Returns whether or not the instruction is a call to a script function.
+ *
+ * @return True if the instruction is a script function call, otherwise false.
+ */
virtual bool isFuncCall() const;
+
+ /**
+ * Returns whether or not the instruction is a return statement.
+ *
+ * @return True if the instruction is a return statement, otherwise false.
+ */
virtual bool isReturn() const;
+
+ /**
+ * Returns whether or not the instruction is a call to a kernel function.
+ *
+ * @return True if the instruction is a kernel function call, otherwise false.
+ */
virtual bool isKernelCall() const;
+
+ /**
+ * Returns whether or not the instruction is a load operation.
+ *
+ * @return True if the instruction is a load operation, otherwise false.
+ */
virtual bool isLoad() const;
+
+ /**
+ * Returns whether or not the instruction is a store operation.
+ *
+ * @return True if the instruction is a load operation, otherwise false.
+ *//**
+ * Instruction performing a stack operation.
+ */
virtual bool isStore() const;
+
+ /**
+ * Returns the destination address of a jump instruction.
+ *
+ * @return Destination address of a jump instruction.
+ * @throws WrongTypeException if instruction is not a jump.
+ */
virtual uint32 getDestAddress() const;
+ /**
+ * Process an instruction for code generation.
+ *
+ * @param stack The current stack.
+ * @param engine Pointer to the Engine used for code generation.
+ * @param codeGen Pointer to the CodeGenerator used for code generation.
+ */
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen) = 0;
};
+/**
+ * Instruction performing a jump.
+ */
struct JumpInstruction : public Instruction {
public:
virtual bool isJump() const;
};
+/**
+ * Instruction performing a conditional jump.
+ */
struct CondJumpInstruction : public JumpInstruction {
public:
virtual bool isCondJump() const;
};
+/**
+ * Instruction performing an unconditional jump.
+ */
struct UncondJumpInstruction : public JumpInstruction {
public:
virtual bool isUncondJump() const;
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction performing a stack operation.
+ */
struct StackInstruction : public Instruction {
public:
virtual bool isStackOp() const;
};
+/**
+ * Instruction performing a script function call.
+ */
struct CallInstruction : public Instruction {
public:
virtual bool isFuncCall() const;
};
+/**
+ * Instruction which loads data from memory.
+ */
struct LoadInstruction : public Instruction {
public:
virtual bool isLoad() const;
};
+/**
+ * Instruction which stores data to memory.
+ */
struct StoreInstruction : public Instruction {
public:
virtual bool isStore() const;
};
+/**
+ * Instruction duplicating the topmost stack value.
+ */
struct DupInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction performing boolean negation.
+ */
struct BoolNegateInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction performing a binary operation.
+ */
struct BinaryOpInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction which returns from a function.
+ */
struct ReturnInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
virtual bool isReturn() const;
};
+/**
+ * Instruction performing a unary operation, with a prefixed operator.
+ */
struct UnaryOpPrefixInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction performing a unary operation, with a postfixed operator.
+ */
struct UnaryOpPostfixInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Instruction performing a kernel function call.
+ */
struct KernelCallInstruction : public Instruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h 2010-12-14 23:30:22 UTC (rev 54916)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h 2010-12-14 23:54:17 UTC (rev 54917)
@@ -44,37 +44,58 @@
std::vector<std::string> _textStrings; ///< Container for strings from the TEXT chunk.
};
+/**
+ * Kyra2 load instruction.
+ */
class Kyra2LoadInstruction : public LoadInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Kyra2 store instruction.
+ */
class Kyra2StoreInstruction : public StoreInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Kyra2 stack operation.
+ */
class Kyra2StackInstruction : public StackInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Kyra2 conditional jump.
+ */
class Kyra2CondJumpInstruction : public CondJumpInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
virtual uint32 getDestAddress() const;
};
+/**
+ * Kyra2 unconditional jump.
+ */
class Kyra2UncondJumpInstruction : public UncondJumpInstruction {
public:
virtual uint32 getDestAddress() const;
};
+/**
+ * Kyra2 script function call.
+ */
class Kyra2CallInstruction : public CallInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * Kyra2 kernel function call.
+ */
class Kyra2KernelCallInstruction : public KernelCallInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h 2010-12-14 23:30:22 UTC (rev 54916)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/codegen.h 2010-12-14 23:54:17 UTC (rev 54917)
@@ -29,6 +29,9 @@
namespace v6 {
+/**
+ * SCUMM v6 list value.
+ */
class ListValue : public Value {
protected:
const ValueList _items; ///< The list items.
Modified: tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h 2010-12-14 23:30:22 UTC (rev 54916)
+++ tools/branches/gsoc2010-decompiler/decompiler/scummv6/engine.h 2010-12-14 23:54:17 UTC (rev 54917)
@@ -40,10 +40,12 @@
class Scummv6Engine : public Engine {
public:
Disassembler *getDisassembler(InstVec &insts);
- uint32 getDestAddress(const InstPtr inst) const;
CodeGenerator *getCodeGenerator(std::ostream &output);
};
+/**
+ * SCUMM v6 string value.
+ */
class Scummv6StringValue : public StringValue {
public:
/**
@@ -56,37 +58,58 @@
virtual std::ostream &print(std::ostream &output) const;
};
+/**
+ * SCUMM v6 load instruction.
+ */
class Scummv6LoadInstruction : public LoadInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * SCUMM v6 store instruction.
+ */
class Scummv6StoreInstruction : public StoreInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * SCUMM v6 stack operation.
+ */
class Scummv6StackInstruction : public StackInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * SCUMM v6 conditional jump.
+ */
class Scummv6CondJumpInstruction : public CondJumpInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
virtual uint32 getDestAddress() const;
};
+/**
+ * SCUMM v6 unconditional jump.
+ */
class Scummv6JumpInstruction : public UncondJumpInstruction {
public:
virtual uint32 getDestAddress() const;
};
+/**
+ * SCUMM v6 variable increment/decrement.
+ */
class Scummv6IncDecInstruction : public UnaryOpPostfixInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
};
+/**
+ * SCUMM v6 array operation.
+ */
class Scummv6ArrayOpInstruction : public StoreInstruction {
public:
virtual void processInst(ValueStack &stack, Engine *engine, CodeGenerator *codeGen);
Modified: tools/branches/gsoc2010-decompiler/decompiler/value.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/value.h 2010-12-14 23:30:22 UTC (rev 54916)
+++ tools/branches/gsoc2010-decompiler/decompiler/value.h 2010-12-14 23:54:17 UTC (rev 54917)
@@ -110,7 +110,7 @@
virtual uint32 getUnsigned() throw(WrongTypeException);
/**
- * Print the stack entry to an std::ostream.
+ * Print the value to an std::ostream.
*
* @param output The std::ostream to write to.
* @return The std::ostream used for output.
@@ -203,6 +203,8 @@
public:
/**
* Constructor for AddressValue.
+ *
+ * @param addr The absolute address represented by the value.
*/
AddressValue(uint32 addr) : IntValue(addr, false) { }
@@ -222,6 +224,12 @@
const uint32 _baseaddr; ///< The base address for the offset.
public:
+ /**
+ * Constructor for AddressValue.
+ *
+ * @param baseaddr The base address for the offset.
+ * @param offset The relative offset to the base address.
+ */
RelAddressValue(uint32 baseaddr, int32 offset) : IntValue(offset, true), _baseaddr(baseaddr) { };
bool isAddress();
@@ -349,6 +357,7 @@
*
* @param operand Value representing the operand of the operation.
* @param op The operator for this value.
+ * @param isPostfix Whether or not the operator should be postfixed to the operand.
*/
UnaryOpValue(ValuePtr operand, std::string op, bool isPostfix) :
_operand(operand), _op(op), _isPostfix(isPostfix) { }
@@ -363,6 +372,11 @@
*/
class NegatedValue : public UnaryOpValue {
public:
+ /**
+ * Constructor for NegatedValue.
+ *
+ * @param val The value to negate.
+ */
NegatedValue(ValuePtr val) : UnaryOpValue(val, "!", false) { }
virtual ValuePtr negate() throw(WrongTypeException);
};
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