/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. #ifndef LL_LSCRIPT_READLSO_H
  27. #define LL_LSCRIPT_READLSO_H
  28. #include "lscript_byteconvert.h"
  29. #include "linked_lists.h"
  30. // list of op code print functions
  31. void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  32. void print_pop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  33. void print_pops(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  34. void print_popl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  35. void print_popv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  36. void print_popq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  37. void print_poparg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  38. void print_popip(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  39. void print_popbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  40. void print_popsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  41. void print_popslr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  42. void print_dup(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  43. void print_dups(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  44. void print_dupl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  45. void print_dupv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  46. void print_dupq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  47. void print_store(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  48. void print_stores(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  49. void print_storel(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  50. void print_storev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  51. void print_storeq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  52. void print_storeg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  53. void print_storegs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  54. void print_storegl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  55. void print_storegv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  56. void print_storegq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  57. void print_loadp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  58. void print_loadsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  59. void print_loadlp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  60. void print_loadvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  61. void print_loadqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  62. void print_loadgp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  63. void print_loadgsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  64. void print_loadglp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  65. void print_loadgvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  66. void print_loadgqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  67. void print_push(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  68. void print_pushl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  69. void print_pushs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  70. void print_pushv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  71. void print_pushq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  72. void print_pushg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  73. void print_pushgl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  74. void print_pushgs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  75. void print_pushgv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  76. void print_pushgq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  77. void print_puship(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  78. void print_pushbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  79. void print_pushsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  80. void print_pushargb(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  81. void print_pushargi(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  82. void print_pushargf(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  83. void print_pushargs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  84. void print_pushargv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  85. void print_pushargq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  86. void print_pushe(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  87. void print_pushev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  88. void print_pusheq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  89. void print_pusharge(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  90. void print_add(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  91. void print_sub(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  92. void print_mul(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  93. void print_div(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  94. void print_mod(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  95. void print_eq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  96. void print_neq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  97. void print_leq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  98. void print_geq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  99. void print_less(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  100. void print_greater(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  101. void print_bitand(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  102. void print_bitor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  103. void print_bitxor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  104. void print_booland(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  105. void print_boolor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  106. void print_shl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  107. void print_shr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  108. void print_neg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  109. void print_bitnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  110. void print_boolnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  111. void print_jump(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  112. void print_jumpif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  113. void print_jumpnif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  114. void print_state(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  115. void print_call(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  116. void print_return(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  117. void print_cast(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  118. void print_stacktos(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  119. void print_stacktol(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  120. void print_print(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  121. void print_calllib(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  122. void print_calllib_two_byte(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  123. class LLScriptLSOParse
  124. {
  125. public:
  126. LLScriptLSOParse(LLFILE *fp);
  127. LLScriptLSOParse(U8 *buffer);
  128. ~LLScriptLSOParse();
  129. void initOpCodePrinting();
  130. void printData(LLFILE *fp);
  131. void printNameDesc(LLFILE *fp);
  132. void printRegisters(LLFILE *fp);
  133. void printGlobals(LLFILE *fp);
  134. void printGlobalFunctions(LLFILE *fp);
  135. void printStates(LLFILE *fp);
  136. void printHeap(LLFILE *fp);
  137. void printOpCodes(LLFILE *fp, S32 &offset, S32 tabs);
  138. void printOpCodeRange(LLFILE *fp, S32 start, S32 end, S32 tabs);
  139. U8 *mRawData;
  140. void (*mPrintOpCodes[0x100])(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs);
  141. };
  142. void lso_print_tabs(LLFILE *fp, S32 tabs);
  143. #endif