OSDN Git Service

Add .ocamlinit.
[happyabc/happyabc.git] / swflib / bytesOut.mli
1 (**
2     ABC primitive data type.
3
4     Provide the type of ABC primitive data type and byte encodeing function.
5
6     @author mzp
7     @see <http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf> AVM2 Overview(pdf)
8 *)
9
10 (** the type of a primitive data type *)
11 type t
12
13 exception Out_of_range
14
15 (** {6 Create data type }*)
16
17 (** create u8
18
19 @raise InvalidArgumnet If n > 0xFF or n < 0. *)
20 val u8  : int -> t
21
22 (** create u16
23
24 @raise InvalidArgumnet If n > 0xFFFF or n < 0. *)
25 val u16 : int -> t
26
27 (** create u30 *)
28 val u30 : int -> t
29
30 (** create u32 *)
31 val u32 : int -> t
32
33 (** create d64 *)
34 val d64 : float -> t
35
36 (** create s32 *)
37 val s32 : int -> t
38
39 (** create s24 *)
40 val s24 : int -> t
41
42 (** [label l] create label. This label is refered by [lable_ref l].
43
44     This value is removed when encode. *)
45 val label : Label.t -> t
46
47 (** [label_ref l] refer to [label l] position.
48
49     This value become s24 when encode. *)
50 val label_ref : Label.t -> t
51
52 type address = int
53 type map
54 val find : map -> Label.t -> address
55 val backpatch : int -> (address -> map -> int list) -> t
56
57 (**{6 Encode}*)
58
59 (**
60    [to_int_list xs] encode [xs] to [int list].
61 *)
62 val to_int_list : t list -> int list
63
64 (**
65    [output_bytes ch xs] output encoded [xs] to [ch]
66 *)
67 val output_bytes: out_channel -> t list -> unit