00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "pent_include.h"
00022
00023 #include "LoopScriptNodes.h"
00024
00025 #include <map>
00026 #include <string>
00027 extern std::map<sint32, std::string> ScriptExpressions;
00028
00029
00030
00031
00032
00033 void LoopScriptNode::print_unk(Console &o, const uint32 isize) const
00034 {
00035 assert(rtype().type()==Type::T_INVALID);
00036 Node::print_linenum_unk(o, isize);
00037 o.Printf("loopscr(%c)", static_cast<char>(scriptTok));
00038 }
00039
00040 void LoopScriptNode::print_asm(Console &o) const
00041 {
00042 assert(rtype().type()==Type::T_INVALID);
00043 Node::print_linenum_asm(o);
00044 o.Printf("loopscr\t\t%02X \"%c\" - %s", scriptTok, static_cast<char>(scriptTok), ScriptExpressions[scriptTok].c_str());
00045 }
00046
00047 void LoopScriptNode::print_bin(ODequeDataSource &o) const
00048 {
00049 assert(rtype().type()==Type::T_INVALID);
00050 Node::print_linenum_bin(o);
00051 o.write1(0x74);
00052 o.write1(scriptTok);
00053 }
00054
00055 bool LoopScriptNode::fold(DCUnit * , std::deque<Node *> &nodes)
00056 {
00057 fold_linenum(nodes);
00058
00059 return true;
00060 }
00061
00062
00063
00064
00065
00066 bool LoopNode::fold(DCUnit * , std::deque<Node *> &nodes)
00067 {
00068
00069
00070
00071
00072
00073
00074 assert(nodes.size()>0);
00075 while(nodes.size()>0 && (acceptOp(nodes.back()->opcode(), 0x74) && static_cast<LoopScriptNode*>(nodes.back())->lsTok()=='$'))
00076 {
00077 pnode.push_back(grab(nodes));
00078 }
00079
00080
00081
00082
00083
00084
00085
00086 fold_linenum(nodes);
00087
00088 return false;
00089 }
00090
00091 void LoopNode::print_unk(Console &o, const uint32 isize) const
00092 {
00093 print_linenum_unk(o, isize);
00094 o.Printf("search_%s_type_%02X(", suc::print_bp(currObj), searchType);
00095 for(std::deque<Node *>::const_reverse_iterator i=pnode.rbegin(); i!=pnode.rend(); ++i)
00096 {
00097 if(i!=pnode.rbegin()) o.Print(", ");
00098 (*i)->print_unk(o, isize);
00099 }
00100 o.Putchar(')');
00101 }
00102
00103 void LoopNode::print_asm(Console &o) const
00104 {
00105 print_linenum_asm(o);
00106 for(std::deque<Node *>::const_reverse_iterator i=pnode.rbegin(); i!=pnode.rend(); ++i)
00107 {
00108 (*i)->print_asm(o); o.Putchar('\n');
00109 }
00110 Node::print_asm(o);
00111 o.Printf("loop\t\t%s %02X %02X", suc::print_bp(currObj), strSize, searchType);
00112 }
00113
00114 void LoopNode::print_bin(ODequeDataSource &o) const
00115 {
00116 print_linenum_bin(o);
00117 for(std::deque<Node *>::const_reverse_iterator i=pnode.rbegin(); i!=pnode.rend(); ++i)
00118 {
00119 (*i)->print_bin(o);
00120 }
00121 o.write1(0x70);
00122 o.write1(currObj);
00123 o.write1(strSize);
00124 o.write1(searchType);
00125 }
00126
00127
00128
00129
00130
00131 void LoopNextNode::print_unk(Console &o, const uint32 isize) const
00132 {
00133 assert(rtype().type()==Type::T_INVALID);
00134 Node::print_linenum_unk(o, isize);
00135 o.Printf("/*loopnext_NOPRINT()*/");
00136 }
00137
00138 void LoopNextNode::print_asm(Console &o) const
00139 {
00140 assert(rtype().type()==Type::T_INVALID);
00141 Node::print_linenum_asm(o);
00142 o.Printf("loopnext");
00143 }
00144
00145 void LoopNextNode::print_bin(ODequeDataSource &o) const
00146 {
00147 assert(rtype().type()==Type::T_INVALID);
00148 Node::print_linenum_bin(o);
00149 o.write1(0x73);
00150 }
00151
00152 bool LoopNextNode::fold(DCUnit * , std::deque<Node *> & )
00153 {
00154
00155
00156 return true;
00157 }
00158