00001
00032 #ifndef LL_LSCRIPT_READLSO_H
00033 #define LL_LSCRIPT_READLSO_H
00034
00035 #include "lscript_byteconvert.h"
00036 #include "linked_lists.h"
00037
00038
00039 void print_noop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00040 void print_pop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00041 void print_pops(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00042 void print_popl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00043 void print_popv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00044 void print_popq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00045 void print_poparg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00046 void print_popip(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00047 void print_popbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00048 void print_popsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00049 void print_popslr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00050
00051 void print_dup(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00052 void print_dups(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00053 void print_dupl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00054 void print_dupv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00055 void print_dupq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00056
00057 void print_store(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00058 void print_stores(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00059 void print_storel(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00060 void print_storev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00061 void print_storeq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00062 void print_storeg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00063 void print_storegs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00064 void print_storegl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00065 void print_storegv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00066 void print_storegq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00067 void print_loadp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00068 void print_loadsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00069 void print_loadlp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00070 void print_loadvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00071 void print_loadqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00072 void print_loadgp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00073 void print_loadgsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00074 void print_loadglp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00075 void print_loadgvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00076 void print_loadgqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00077
00078 void print_push(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00079 void print_pushl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00080 void print_pushs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00081 void print_pushv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00082 void print_pushq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00083 void print_pushg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00084 void print_pushgl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00085 void print_pushgs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00086 void print_pushgv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00087 void print_pushgq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00088 void print_puship(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00089 void print_pushbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00090 void print_pushsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00091 void print_pushargb(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00092 void print_pushargi(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00093 void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00094 void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00095 void print_pushargv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00096 void print_pushargq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00097 void print_pushe(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00098 void print_pushev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00099 void print_pusheq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00100 void print_pusharge(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00101
00102 void print_add(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00103 void print_sub(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00104 void print_mul(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00105 void print_div(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00106 void print_mod(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00107
00108 void print_eq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00109 void print_neq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00110 void print_leq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00111 void print_geq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00112 void print_less(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00113 void print_greater(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00114
00115 void print_bitand(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00116 void print_bitor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00117 void print_bitxor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00118 void print_booland(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00119 void print_boolor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00120
00121 void print_shl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00122 void print_shr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00123
00124 void print_neg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00125 void print_bitnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00126 void print_boolnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00127
00128 void print_jump(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00129 void print_jumpif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00130 void print_jumpnif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00131
00132 void print_state(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00133 void print_call(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00134 void print_return(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00135 void print_cast(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00136 void print_stacktos(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00137 void print_stacktol(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00138
00139 void print_print(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00140
00141 void print_calllib(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00142 void print_calllib_two_byte(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00143
00144 class LLScriptLSOParse
00145 {
00146 public:
00147 LLScriptLSOParse(FILE *fp);
00148 LLScriptLSOParse(U8 *buffer);
00149 ~LLScriptLSOParse();
00150
00151 void initOpCodePrinting();
00152
00153 void printData(FILE *fp);
00154 void printNameDesc(FILE *fp);
00155 void printRegisters(FILE *fp);
00156 void printGlobals(FILE *fp);
00157 void printGlobalFunctions(FILE *fp);
00158 void printStates(FILE *fp);
00159 void printHeap(FILE *fp);
00160 void printOpCodes(FILE *fp, S32 &offset, S32 tabs);
00161 void printOpCodeRange(FILE *fp, S32 start, S32 end, S32 tabs);
00162
00163 U8 *mRawData;
00164 void (*mPrintOpCodes[0x100])(FILE *fp, U8 *buffer, S32 &offset, S32 tabs);
00165 };
00166
00167
00168 void lso_print_tabs(FILE *fp, S32 tabs);
00169
00170 #endif