PageRenderTime 22ms CodeModel.GetById 2ms app.highlight 17ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/lscript/lscript_execute/lscript_readlso.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 165 lines | 117 code | 22 blank | 26 comment | 0 complexity | ff7c9f6491e42a01dd882b950333f7c0 MD5 | raw file
  1/** 
  2 * @file lscript_readlso.h
  3 * @brief classes to read lso file
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LSCRIPT_READLSO_H
 28#define LL_LSCRIPT_READLSO_H
 29
 30#include "lscript_byteconvert.h"
 31#include "linked_lists.h"
 32
 33// list of op code print functions
 34void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 35void print_pop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 36void print_pops(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 37void print_popl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 38void print_popv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 39void print_popq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 40void print_poparg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 41void print_popip(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 42void print_popbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 43void print_popsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 44void print_popslr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 45
 46void print_dup(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 47void print_dups(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 48void print_dupl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 49void print_dupv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 50void print_dupq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 51
 52void print_store(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 53void print_stores(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 54void print_storel(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 55void print_storev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 56void print_storeq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 57void print_storeg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 58void print_storegs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 59void print_storegl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 60void print_storegv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 61void print_storegq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 62void print_loadp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 63void print_loadsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 64void print_loadlp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 65void print_loadvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 66void print_loadqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 67void print_loadgp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 68void print_loadgsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 69void print_loadglp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 70void print_loadgvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 71void print_loadgqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 72
 73void print_push(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 74void print_pushl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 75void print_pushs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 76void print_pushv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 77void print_pushq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 78void print_pushg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 79void print_pushgl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 80void print_pushgs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 81void print_pushgv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 82void print_pushgq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 83void print_puship(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 84void print_pushbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 85void print_pushsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 86void print_pushargb(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 87void print_pushargi(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 88void print_pushargf(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 89void print_pushargs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 90void print_pushargv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 91void print_pushargq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 92void print_pushe(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 93void print_pushev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 94void print_pusheq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 95void print_pusharge(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 96
 97void print_add(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 98void print_sub(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
 99void print_mul(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
100void print_div(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
101void print_mod(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
102
103void print_eq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
104void print_neq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
105void print_leq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
106void print_geq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
107void print_less(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
108void print_greater(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
109
110void print_bitand(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
111void print_bitor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
112void print_bitxor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
113void print_booland(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
114void print_boolor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
115
116void print_shl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
117void print_shr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
118
119void print_neg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
120void print_bitnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
121void print_boolnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
122
123void print_jump(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
124void print_jumpif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
125void print_jumpnif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
126
127void print_state(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
128void print_call(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
129void print_return(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
130void print_cast(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
131void print_stacktos(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
132void print_stacktol(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
133
134void print_print(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
135
136void print_calllib(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
137void print_calllib_two_byte(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
138
139class LLScriptLSOParse
140{
141public:
142	LLScriptLSOParse(LLFILE *fp);
143	LLScriptLSOParse(U8 *buffer);
144	~LLScriptLSOParse();
145
146	void initOpCodePrinting();
147
148	void printData(LLFILE *fp);
149	void printNameDesc(LLFILE *fp);
150	void printRegisters(LLFILE *fp);
151	void printGlobals(LLFILE *fp);
152	void printGlobalFunctions(LLFILE *fp);
153	void printStates(LLFILE *fp);
154	void printHeap(LLFILE *fp);
155	void printOpCodes(LLFILE *fp, S32 &offset, S32 tabs);
156	void printOpCodeRange(LLFILE *fp, S32 start, S32 end, S32 tabs);
157
158	U8	*mRawData;
159	void (*mPrintOpCodes[0x100])(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
160};
161
162
163void lso_print_tabs(LLFILE *fp, S32 tabs);
164
165#endif