2
0

as3.mli 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. (*
  2. * This file is part of SwfLib
  3. * Copyright (c)2004-2006 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. type 'a index
  21. type 'a index_nz
  22. type as3_ident = string
  23. type as3_int = int32
  24. type as3_uint = int32
  25. type as3_float = float
  26. type as3_slot = int
  27. type reg = int
  28. type nargs = int
  29. type as3_jump =
  30. | J3NotLt
  31. | J3NotLte
  32. | J3NotGt
  33. | J3NotGte
  34. | J3Always
  35. | J3True
  36. | J3False
  37. | J3Eq
  38. | J3Neq
  39. | J3Lt
  40. | J3Lte
  41. | J3Gt
  42. | J3Gte
  43. | J3PhysEq
  44. | J3PhysNeq
  45. type as3_op =
  46. | A3OAs
  47. | A3ONeg
  48. | A3OIncr
  49. | A3ODecr
  50. | A3ONot
  51. | A3OBitNot
  52. | A3OAdd
  53. | A3OSub
  54. | A3OMul
  55. | A3ODiv
  56. | A3OMod
  57. | A3OShl
  58. | A3OShr
  59. | A3OUShr
  60. | A3OAnd
  61. | A3OOr
  62. | A3OXor
  63. | A3OEq
  64. | A3OPhysEq
  65. | A3OLt
  66. | A3OLte
  67. | A3OGt
  68. | A3OGte
  69. | A3OIs
  70. | A3OIn
  71. | A3OIIncr
  72. | A3OIDecr
  73. | A3OINeg
  74. | A3OIAdd
  75. | A3OISub
  76. | A3OIMul
  77. | A3OMemSet8
  78. | A3OMemSet16
  79. | A3OMemSet32
  80. | A3OMemSetFloat
  81. | A3OMemSetDouble
  82. | A3OMemGet8
  83. | A3OMemGet16
  84. | A3OMemGet32
  85. | A3OMemGetFloat
  86. | A3OMemGetDouble
  87. | A3OSign1
  88. | A3OSign8
  89. | A3OSign16
  90. type as3_name = as3_multi_name index
  91. and as3_opcode =
  92. | A3BreakPoint
  93. | A3Nop
  94. | A3Throw
  95. | A3GetSuper of as3_name
  96. | A3SetSuper of as3_name
  97. | A3DxNs of as3_ident index
  98. | A3DxNsLate
  99. | A3RegKill of reg
  100. | A3Label
  101. | A3Jump of as3_jump * int
  102. | A3Switch of int * int list
  103. | A3PushWith
  104. | A3PopScope
  105. | A3ForIn
  106. | A3HasNext
  107. | A3Null
  108. | A3Undefined
  109. | A3ForEach
  110. | A3SmallInt of int
  111. | A3Int of int
  112. | A3True
  113. | A3False
  114. | A3NaN
  115. | A3Pop
  116. | A3Dup
  117. | A3Swap
  118. | A3String of as3_ident index
  119. | A3IntRef of as3_int index
  120. | A3UIntRef of as3_uint index
  121. | A3Float of as3_float index
  122. | A3Scope
  123. | A3Namespace of as3_namespace index
  124. | A3Next of reg * reg
  125. | A3Function of as3_method_type index_nz
  126. | A3CallStack of nargs
  127. | A3Construct of nargs
  128. | A3CallMethod of as3_slot * nargs
  129. | A3CallStatic of as3_method_type index * nargs
  130. | A3CallSuper of as3_name * nargs
  131. | A3CallProperty of as3_name * nargs
  132. | A3RetVoid
  133. | A3Ret
  134. | A3ConstructSuper of nargs
  135. | A3ConstructProperty of as3_name * nargs
  136. | A3CallPropLex of as3_name * nargs
  137. | A3CallSuperVoid of as3_name * nargs
  138. | A3CallPropVoid of as3_name * nargs
  139. | A3ApplyType of nargs
  140. | A3Object of nargs
  141. | A3Array of nargs
  142. | A3NewBlock
  143. | A3ClassDef of unit index_nz
  144. | A3GetDescendants of as3_name
  145. | A3Catch of int
  146. | A3FindPropStrict of as3_name
  147. | A3FindProp of as3_name
  148. | A3FindDefinition of as3_name
  149. | A3GetLex of as3_name
  150. | A3SetProp of as3_name
  151. | A3Reg of reg
  152. | A3SetReg of reg
  153. | A3GetGlobalScope
  154. | A3GetScope of int
  155. | A3GetProp of as3_name
  156. | A3InitProp of as3_name
  157. | A3DeleteProp of as3_name
  158. | A3GetSlot of as3_slot
  159. | A3SetSlot of as3_slot
  160. | A3ToString
  161. | A3ToXml
  162. | A3ToXmlAttr
  163. | A3ToInt
  164. | A3ToUInt
  165. | A3ToNumber
  166. | A3ToBool
  167. | A3ToObject
  168. | A3CheckIsXml
  169. | A3Cast of as3_name
  170. | A3AsAny
  171. | A3AsString
  172. | A3AsType of as3_name
  173. | A3AsObject
  174. | A3IncrReg of reg
  175. | A3DecrReg of reg
  176. | A3Typeof
  177. | A3InstanceOf
  178. | A3IsType of as3_name
  179. | A3IncrIReg of reg
  180. | A3DecrIReg of reg
  181. | A3This
  182. | A3SetThis
  183. | A3DebugReg of as3_ident index * reg * int
  184. | A3DebugLine of int
  185. | A3DebugFile of as3_ident index
  186. | A3BreakPointLine of int
  187. | A3Timestamp
  188. | A3Op of as3_op
  189. | A3Unk of char
  190. and as3_namespace =
  191. | A3NPrivate of as3_ident index option
  192. | A3NPublic of as3_ident index option
  193. | A3NInternal of as3_ident index option
  194. | A3NProtected of as3_ident index
  195. | A3NNamespace of as3_ident index
  196. | A3NExplicit of as3_ident index
  197. | A3NStaticProtected of as3_ident index option
  198. and as3_ns_set = as3_namespace index list
  199. and as3_multi_name =
  200. | A3MName of as3_ident index * as3_namespace index
  201. | A3MMultiName of as3_ident index option * as3_ns_set index
  202. | A3MRuntimeName of as3_ident index
  203. | A3MRuntimeNameLate
  204. | A3MMultiNameLate of as3_ns_set index
  205. | A3MAttrib of as3_multi_name
  206. | A3MParams of as3_multi_name index * as3_multi_name index list
  207. | A3MNSAny of as3_ident index
  208. | A3MAny
  209. and as3_value =
  210. | A3VNone
  211. | A3VNull
  212. | A3VBool of bool
  213. | A3VString of as3_ident index
  214. | A3VInt of as3_int index
  215. | A3VUInt of as3_uint index
  216. | A3VFloat of as3_float index
  217. | A3VNamespace of int * as3_namespace index (* int : kind of namespace *)
  218. and as3_method_type = {
  219. mt3_ret : as3_name option;
  220. mt3_args : as3_name option list;
  221. mt3_native : bool;
  222. mt3_var_args : bool;
  223. mt3_arguments_defined : bool;
  224. mt3_uses_dxns : bool;
  225. mt3_new_block : bool;
  226. mt3_unused_flag : bool;
  227. mt3_debug_name : as3_ident index option;
  228. mt3_dparams : as3_value list option;
  229. mt3_pnames : as3_ident index option list option;
  230. }
  231. type as3_method_kind =
  232. | MK3Normal
  233. | MK3Getter
  234. | MK3Setter
  235. type as3_method = {
  236. m3_type : as3_method_type index_nz;
  237. m3_final : bool;
  238. m3_override : bool;
  239. m3_kind : as3_method_kind;
  240. }
  241. type as3_var = {
  242. v3_type : as3_name option;
  243. v3_value : as3_value;
  244. v3_const : bool;
  245. }
  246. type as3_metadata = {
  247. meta3_name : as3_ident index;
  248. meta3_data : (as3_ident index option * as3_ident index) array;
  249. }
  250. type as3_field_kind =
  251. | A3FMethod of as3_method
  252. | A3FVar of as3_var
  253. | A3FClass of as3_class index_nz
  254. | A3FFunction of as3_method_type index_nz
  255. and as3_field = {
  256. f3_name : as3_name;
  257. f3_slot : as3_slot;
  258. f3_kind : as3_field_kind;
  259. f3_metas : as3_metadata index_nz array option;
  260. }
  261. and as3_class = {
  262. cl3_name : as3_name;
  263. cl3_super : as3_name option;
  264. cl3_sealed : bool;
  265. cl3_final : bool;
  266. cl3_interface : bool;
  267. cl3_namespace : as3_namespace index option;
  268. cl3_implements : as3_name array;
  269. cl3_construct : as3_method_type index_nz;
  270. cl3_fields : as3_field array;
  271. }
  272. type as3_static = {
  273. st3_method : as3_method_type index_nz;
  274. st3_fields : as3_field array;
  275. }
  276. type as3_try_catch = {
  277. tc3_start : int;
  278. tc3_end : int;
  279. tc3_handle : int;
  280. tc3_type : as3_name option;
  281. tc3_name : as3_name option;
  282. }
  283. type as3_function = {
  284. fun3_id : as3_method_type index_nz;
  285. fun3_stack_size : int;
  286. fun3_nregs : int;
  287. fun3_init_scope : int;
  288. fun3_max_scope : int;
  289. fun3_code : as3_opcode MultiArray.t;
  290. fun3_trys : as3_try_catch array;
  291. fun3_locals : as3_field array;
  292. }
  293. type as3_tag = {
  294. as3_ints : as3_int array;
  295. as3_uints : as3_uint array;
  296. as3_floats : as3_float array;
  297. as3_idents : as3_ident array;
  298. as3_namespaces : as3_namespace array;
  299. as3_nsets : as3_ns_set array;
  300. mutable as3_names : as3_multi_name array;
  301. mutable as3_method_types : as3_method_type array;
  302. mutable as3_metadatas : as3_metadata array;
  303. mutable as3_classes : as3_class array;
  304. mutable as3_statics : as3_static array;
  305. mutable as3_inits : as3_static array;
  306. mutable as3_functions : as3_function array;
  307. mutable as3_unknown : string; (* only for partial parsing *)
  308. }