00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FUNCNODES_H
00022 #define FUNCNODES_H
00023
00024 #include "GenericNodes.h"
00025 #include "CallNodes.h"
00026 #include <deque>
00027 #include <string>
00028
00029 class FuncMutatorNode : public Node
00030 {
00031 public:
00032 FuncMutatorNode(const uint32 opcode, const uint32 offset, const uint32 newValue1)
00033 : Node(opcode, offset, Type(Type::T_INVALID)),
00034 _initsize(newValue1), _linenum(newValue1)
00035 {
00036 assert(acceptOp(opcode, 0x5A, 0x5B));
00037 switch(opcode)
00038 {
00039 case 0x5A: mtype = INIT; break;
00040 case 0x5B: mtype = LINE_NUMBER; break;
00041 default: assert(false);
00042 }
00043 };
00044 FuncMutatorNode(const uint32 opcode, const uint32 offset, const uint32 newSymbolOffset,
00045 const std::string &newClassName)
00046 : Node(opcode, offset, Type(Type::T_INVALID)),
00047 _symboloffset(newSymbolOffset), _classname(newClassName)
00048 {
00049 assert(acceptOp(opcode, 0x5C));
00050 mtype = SYMBOL_INFO;
00051 };
00052 FuncMutatorNode(const uint32 opcode, const uint32 offset)
00053 : Node(opcode, offset, Type(Type::T_INVALID))
00054 {
00055 assert(acceptOp(opcode, 0x50, 0x53, 0x7A));
00056 switch(opcode)
00057 {
00058 case 0x50: mtype = RET; break;
00059 case 0x53: mtype = SUSPEND; break;
00060 case 0x7A: mtype = END; break;
00061 default: assert(false);
00062 }
00063 };
00064 ~FuncMutatorNode() {};
00065
00066 void print_unk(Console &o, const uint32 isize, const bool comment) const;
00067 void print_unk(Console &o, const uint32 isize) const { print_unk(o, isize, true); };
00068 void print_asm(Console &o) const;
00069 void print_bin(ODequeDataSource &o) const;
00070 bool fold(DCUnit *unit, std::deque<Node *> &nodes);
00071
00072 protected:
00073 enum mutatortype { RET, INIT, LINE_NUMBER, SYMBOL_INFO, SUSPEND, END } mtype;
00074
00075 private:
00076 uint32 _initsize;
00077 uint32 _linenum;
00078 uint32 _symboloffset;
00079 std::string _classname;
00080
00081 public:
00082 uint32 a_initsize() const { assert(opcode()==0x5A && mtype==INIT); return _initsize; };
00083 };
00084
00085 class DCFuncNode : public ColNode
00086 {
00087 public:
00088 DCFuncNode()
00089 : ColNode(0xFFFF, 0x0000, Type(Type::T_INVALID)),
00090 setinfonode(0),
00091 locals_datasize(0), func_start_offset(0),
00092 debug_ret_offset(0), debug_end_offset(0),
00093 process_type(0), debug_processtype_offset(0), debug_thisp(false),
00094 debug_procexclude_offset(0), has_procexclude(false)
00095 {
00096 };
00097 ~DCFuncNode() {};
00098
00099 void print_unk_funcheader(Console &o, const uint32 isize) const;
00100 void print_unk(Console &o, const uint32 isize) const;
00101 void print_asm(Console &o) const;
00102 void print_bin(ODequeDataSource &o) const;
00103 bool fold(DCUnit *unit, std::deque<Node *> &nodes);
00104 void addEnd(FuncMutatorNode *n)
00105 {
00106 assert(n!=0);
00107 assert(n->opcode()==0x7A);
00108 debug_end_offset = n->offset();
00109 FORGET_OBJECT(n);
00110 };
00111
00112 protected:
00113 std::deque<Node *> funcnodes;
00114 DCCallMutatorNode *setinfonode;
00115
00116 uint32 locals_datasize;
00117 uint32 func_start_offset;
00118 uint32 debug_ret_offset;
00119 uint32 debug_end_offset;
00120
00121 uint32 process_type;
00122 uint32 debug_processtype_offset;
00123 bool debug_thisp;
00124
00125 uint32 debug_procexclude_offset;
00126 bool has_procexclude;
00127
00128 private:
00129 void fold_init(DCUnit *unit, std::deque<Node *> &nodes);
00130 void fold_ret(DCUnit *unit, std::deque<Node *> &nodes);
00131 void fold_setinfo(DCUnit *unit, std::deque<Node *> &nodes);
00132 void fold_procexclude(DCUnit *unit, std::deque<Node *> &nodes);
00133 };
00134
00135 #endif
00136