Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (71 sloc) 2.451 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (**
19 Runtime library for qmlClosure in caml
20
21 Meant for QmlClosure, for backends (to allow the bsl to
22 manipulate directly the closure through the server lib)
23 and for the closure bsl
24 *)
25
26 module AnyArray : sig
27 type t = Obj.t array
28 val create : int -> t
29 val set : t -> int -> 'a -> unit
30 val get : t -> int -> 'a
31 val length : t -> int
32 val append_sub : t -> int -> t -> t
33 val sub : t -> int -> t
34 val sub2 : t -> int -> int -> t
35 val append : t -> t -> t
36 end
37
38 (**/**)
39 #<Ifstatic:CPS_WITH_ML_CLOSURE .*>
40 type t
41 #<Else>
42 (* this type is exposed for manipulation ONLY by the code generated by QmlClosure *)
43 type t = {
44 arity : int;
45 mutable identifier : Obj.t option;
46 args: AnyArray.t;
47 mutable func: Obj.t;
48 }
49 #<End>
50 (**/**)
51
52 (** {6 Debug} *)
53
54 val check : 'a -> bool
55 val assert_ : 'a -> t
56 val show : 'a -> string
57
58 (** {6 Allocation} *)
59
60 val create : 'ml_closure -> int -> 'record -> t
61 val create_no_ident : 'ml_closure -> int -> t
62 val create_no_ident1 : 'ml_closure -> t
63 val create_no_ident2 : 'ml_closure -> t
64 val create_no_function : int -> 'record -> t
65 val create_anyarray : 'ml_closure -> int -> 'record -> t
66 val define_function : t -> 'ml_closure -> unit
67
68 (** {6 Application} *)
69
70 (** full application of a closure *)
71 val args_apply : t -> AnyArray.t -> 'result
72 val args_apply1 : t -> 'arg1 -> 'result
73 val args_apply2 : t -> 'arg1 -> 'arg2 -> 'result
74
75 (** partial application of a closure *)
76 val env_apply : t -> AnyArray.t -> t
77 val env_apply1 : t -> 'arg1 -> t
78 val env_apply2 : t -> 'arg1 -> 'arg2 -> t
79
80 (** {6 Interface for serialization} *)
81
82 val is_empty : 'closure -> bool
83 val get_identifier : 'closure -> 'ident option
84 val set_identifier : t -> 'ident -> unit
85
86 (** {6 Interface for bsl projections} *)
87
88 val import : 'ml_closure -> int -> t
89 val export : t -> 'ml_closure
Something went wrong with that request. Please try again.