00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 #ifndef MATHNODES_H
00022 #define MATHNODES_H
00023 
00024 #include "GenericNodes.h"
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 class UniOperatorNode : public UniNode
00125 {
00126         public:
00127                 UniOperatorNode(const uint32 opcode, const uint32 offset)
00128                         : UniNode(opcode, offset, Type(Type::T_INVALID))
00129                         {
00130                                 assert(acceptOp(opcode, 0x30, 0x6B));
00131                                 switch(opcode)
00132                                 {
00133                                         case 0x30: otype = NOT; rtype(Type::T_WORD); break;
00134                                         case 0x6B: otype = STR_TO_PTR; rtype(Type::T_STRPTR); break;
00135                                         default: assert(false);
00136                                 }
00137                         };
00138                 ~UniOperatorNode() {};
00139 
00140                 void print_unk(Console &o, const uint32 isize) const;
00141                 void print_asm(Console &o) const;
00142                 void print_bin(ODequeDataSource  &o) const;
00143                 bool fold(DCUnit *unit, std::deque<Node *> &nodes);
00144 
00145         protected:
00146                 enum optype { NOT, STR_TO_PTR } otype;
00147 
00148         private:
00149 };
00150 
00151 class BinOperatorNode : public BinNode
00152 {
00153         public:
00154                 BinOperatorNode(const uint32 opcode, const uint32 offset)
00155                         : BinNode(opcode, offset, Type(Type::T_INVALID))
00156                         {
00157                                 assert(acceptOp(opcode, 0x14, 0x1C, 0x1E) || acceptOp(opcode, 0x24, 0x28, 0x2A, 0x2C)
00158                                         || acceptOp(opcode, 0x32, 0x34, 0x36) || acceptOp(opcode, 0x54));
00159                                 switch(opcode)
00160                                 {
00161                                         case 0x14: otype = M_ADD;     rtype(Type::T_WORD); break;
00162                                         case 0x1C: otype = M_SUB;     rtype(Type::T_WORD); break;
00163                                         case 0x1E: otype = M_MUL;     rtype(Type::T_WORD); break;
00164 
00165                                         case 0x24: otype = M_CMP;     rtype(Type::T_WORD); break;
00166                                         case 0x28: otype = M_LT;      rtype(Type::T_WORD); break;
00167                                         case 0x2A: otype = M_LE;      rtype(Type::T_WORD); break;
00168                                         case 0x2C: otype = M_GT;      rtype(Type::T_WORD); break;
00169                                         case 0x32: otype = M_AND;     rtype(Type::T_WORD); break;
00170                                         case 0x34: otype = M_OR;      rtype(Type::T_WORD); break;
00171                                         case 0x36: otype = M_NE;      rtype(Type::T_WORD); break;
00172 
00173                                         case 0x54: otype = M_IMPLIES; rtype(Type::T_WORD); break;
00174 
00175                                         default: assert(false);
00176                                 }
00177                         };
00178                 ~BinOperatorNode() {};
00179 
00180                 void print_unk(Console &o, const uint32 isize) const;
00181                 void print_asm(Console &o) const;
00182                 void print_bin(ODequeDataSource  &o) const;
00183                 bool fold(DCUnit *unit, std::deque<Node *> &nodes);
00184 
00185         protected:
00186                 enum optype { M_ADD, M_SUB, M_MUL, M_CMP, M_AND, M_OR, M_NE, M_LT, M_LE, M_GT, M_IMPLIES } otype;
00187 
00188         private:
00189 };
00190 
00191 #endif