as3hl.mli 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. (*
  2. * This file is part of SwfLib
  3. * Copyright (c)2004-2008 Nicolas Cannasse
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  18. *)
  19. open Extlib_leftovers
  20. open As3
  21. type hl_ident = string
  22. type hl_int = int32
  23. type hl_uint = int32
  24. type hl_float = float
  25. type hl_slot = int
  26. type hl_jump = as3_jump
  27. type hl_op = as3_op
  28. type hl_opcode =
  29. | HBreakPoint
  30. | HNop
  31. | HThrow
  32. | HGetSuper of hl_name
  33. | HSetSuper of hl_name
  34. | HDxNs of hl_ident
  35. | HDxNsLate
  36. | HRegKill of reg
  37. | HLabel
  38. | HJump of hl_jump * int
  39. | HSwitch of int * int list
  40. | HPushWith
  41. | HPopScope
  42. | HForIn
  43. | HHasNext
  44. | HNull
  45. | HUndefined
  46. | HForEach
  47. | HSmallInt of int
  48. | HInt of int
  49. | HTrue
  50. | HFalse
  51. | HNaN
  52. | HPop
  53. | HDup
  54. | HSwap
  55. | HString of hl_ident
  56. | HIntRef of hl_int
  57. | HUIntRef of hl_uint
  58. | HFloat of hl_float
  59. | HScope
  60. | HNamespace of hl_namespace
  61. | HNext of reg * reg
  62. | HFunction of hl_method
  63. | HCallStack of nargs
  64. | HConstruct of nargs
  65. | HCallMethod of hl_slot * nargs
  66. | HCallStatic of hl_method * nargs
  67. | HCallSuper of hl_name * nargs
  68. | HCallProperty of hl_name * nargs
  69. | HRetVoid
  70. | HRet
  71. | HConstructSuper of nargs
  72. | HConstructProperty of hl_name * nargs
  73. | HCallPropLex of hl_name * nargs
  74. | HCallSuperVoid of hl_name * nargs
  75. | HCallPropVoid of hl_name * nargs
  76. | HApplyType of nargs
  77. | HObject of nargs
  78. | HArray of nargs
  79. | HNewBlock
  80. | HClassDef of hl_class
  81. | HGetDescendants of hl_name
  82. | HCatch of int
  83. | HFindPropStrict of hl_name
  84. | HFindProp of hl_name
  85. | HFindDefinition of hl_name
  86. | HGetLex of hl_name
  87. | HSetProp of hl_name
  88. | HReg of reg
  89. | HSetReg of reg
  90. | HGetGlobalScope
  91. | HGetScope of int
  92. | HGetProp of hl_name
  93. | HInitProp of hl_name
  94. | HDeleteProp of hl_name
  95. | HGetSlot of hl_slot
  96. | HSetSlot of hl_slot
  97. | HToString
  98. | HToXml
  99. | HToXmlAttr
  100. | HToInt
  101. | HToUInt
  102. | HToNumber
  103. | HToBool
  104. | HToObject
  105. | HCheckIsXml
  106. | HCast of hl_name
  107. | HAsAny
  108. | HAsString
  109. | HAsType of hl_name
  110. | HAsObject
  111. | HIncrReg of reg
  112. | HDecrReg of reg
  113. | HTypeof
  114. | HInstanceOf
  115. | HIsType of hl_name
  116. | HIncrIReg of reg
  117. | HDecrIReg of reg
  118. | HThis
  119. | HSetThis
  120. | HDebugReg of hl_ident * reg * int
  121. | HDebugLine of int
  122. | HDebugFile of hl_ident
  123. | HBreakPointLine of int
  124. | HTimestamp
  125. | HOp of hl_op
  126. | HUnk of char
  127. and hl_namespace =
  128. | HNPrivate of hl_ident option
  129. | HNPublic of hl_ident option
  130. | HNInternal of hl_ident option
  131. | HNProtected of hl_ident
  132. | HNNamespace of hl_ident
  133. | HNExplicit of hl_ident
  134. | HNStaticProtected of hl_ident option
  135. and hl_ns_set = hl_namespace list
  136. and hl_name =
  137. | HMPath of hl_ident list * hl_ident
  138. | HMName of hl_ident * hl_namespace
  139. | HMMultiName of hl_ident option * hl_ns_set
  140. | HMRuntimeName of hl_ident
  141. | HMRuntimeNameLate
  142. | HMMultiNameLate of hl_ns_set
  143. | HMAttrib of hl_name
  144. | HMParams of hl_name * hl_name list
  145. | HMNSAny of hl_ident
  146. | HMAny
  147. and hl_value =
  148. | HVNone
  149. | HVNull
  150. | HVBool of bool
  151. | HVString of hl_ident
  152. | HVInt of hl_int
  153. | HVUInt of hl_uint
  154. | HVFloat of hl_float
  155. | HVNamespace of int * hl_namespace
  156. and hl_method = {
  157. hlmt_index : int; (* used to sort methods (preserve order) *)
  158. hlmt_ret : hl_name option;
  159. hlmt_args : hl_name option list;
  160. hlmt_native : bool;
  161. hlmt_var_args : bool;
  162. hlmt_arguments_defined : bool;
  163. hlmt_uses_dxns : bool;
  164. hlmt_new_block : bool;
  165. hlmt_unused_flag : bool;
  166. hlmt_debug_name : hl_ident option;
  167. hlmt_dparams : hl_value list option;
  168. hlmt_pnames : hl_ident option list option;
  169. mutable hlmt_function : hl_function option; (* None for interfaces constructors only *)
  170. }
  171. and hl_try_catch = {
  172. hltc_start : int;
  173. hltc_end : int;
  174. hltc_handle : int;
  175. hltc_type : hl_name option;
  176. hltc_name : hl_name option;
  177. }
  178. and hl_function = {
  179. hlf_stack_size : int;
  180. hlf_nregs : int;
  181. hlf_init_scope : int;
  182. hlf_max_scope : int;
  183. mutable hlf_code : hl_opcode MultiArray.t;
  184. mutable hlf_trys : hl_try_catch array;
  185. hlf_locals : (hl_name * hl_name option * hl_slot * bool) array; (* bool = const - mostly false *)
  186. }
  187. and hl_method_kind = as3_method_kind
  188. and hl_method_field = {
  189. hlm_type : hl_method;
  190. hlm_final : bool;
  191. hlm_override : bool;
  192. hlm_kind : hl_method_kind;
  193. }
  194. and hl_var_field = {
  195. hlv_type : hl_name option;
  196. hlv_value : hl_value;
  197. hlv_const : bool;
  198. }
  199. and hl_metadata = {
  200. hlmeta_name : hl_ident;
  201. hlmeta_data : (hl_ident option * hl_ident) array;
  202. }
  203. and hl_field_kind =
  204. | HFMethod of hl_method_field
  205. | HFVar of hl_var_field
  206. | HFFunction of hl_method
  207. | HFClass of hl_class (* only for hl_static fields *)
  208. and hl_field = {
  209. hlf_name : hl_name;
  210. hlf_slot : hl_slot;
  211. hlf_kind : hl_field_kind;
  212. hlf_metas : hl_metadata array option;
  213. }
  214. and hl_class = {
  215. hlc_index : int;
  216. hlc_name : hl_name;
  217. hlc_super : hl_name option;
  218. hlc_sealed : bool;
  219. hlc_final : bool;
  220. hlc_interface : bool;
  221. hlc_namespace : hl_namespace option;
  222. hlc_implements : hl_name array;
  223. mutable hlc_construct : hl_method;
  224. mutable hlc_fields : hl_field array;
  225. mutable hlc_static_construct : hl_method;
  226. mutable hlc_static_fields : hl_field array;
  227. }
  228. and hl_static = {
  229. hls_method : hl_method;
  230. hls_fields : hl_field array;
  231. }
  232. and hl_tag = hl_static list