as3hl.mli 5.6 KB

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