Skip to content
Newer
Older
100644 116 lines (89 sloc) 3.89 KB
fccc685 Initial open-source release
MLstate authored Jun 21, 2011
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 (** Retrieve the current idents, after any renaming, from original
19 names. *)
20 (** {6 How use it?}*)
21
22 (** This module link ident expressions with a string corresponding to
23 the original name on the code after any renaming. So, once
24 renaming is done, you can call [typ "list"] to get the ident of
25 the type "list", or [val_ "myvar"] to get the ident of the myvar
26 variable.
27
28 All optional argument [side] is by default equals to
29 [`server]. Before slicing, for all functions that take an optional
30 argument [side:`client] should be throw an exception.
31
32 With the introduction of opacapi in the compiler, you are not
33 allowed to perform query to string which are not in opacapi.
34 *)
35
36 (** {6 Side definition} *)
37 (** Describe the side *)
38 type side = [`server | `client]
39
40 (** Get the other side *)
41 val other_side : side -> side
42
43 (** {6 Values}*)
44
45 val val_noerr : ?side:side -> string -> QmlAst.ident
46 (** Get the ident of the value originally named by the given
47 [string]. Throw [Not_found] if the name doesn't exists on the
48 corresponding [side]. *)
49
50 val val_ : ?side:side -> string -> QmlAst.ident
51 (**
52 same as [val_noerr], excepts that is prints an error message and exits instead
53 of raising an exception
54 *)
55
56 (** Get the optional ident of the value originally named by the
57 given [string]. *)
58 val val_opt : ?side:side -> string -> QmlAst.ident option
59
60 (** Add [ident] as the value originally named by the given
61 [string]. Throw an exception if the linking already exists.*)
62 val val_add : ?side:side -> string -> QmlAst.ident
63
64 (** Same as [val_add] but doesn't throw any exception. *)
65 val val_unsafe_add : ?side:side -> string -> QmlAst.ident
66
67 (** {6 Starting server value}
68 If we need other internal ident we can make this function :
69 - val_internal : string -> QmlAst.ident option
70 - val_internal_add : string -> QmlAst.ident
71 ...
72 *)
73 (** Create a [start_server] ident.
74 @raise Failure "start_server" If an start_server ident was
75 already created.
76 *)
77 val val_start_server_add : unit -> QmlAst.ident
78
79 (** Getting the [start_server] ident if it was already created. *)
80 val val_start_server : unit -> QmlAst.ident option
81
82 (** {6 Types}*)
83 (** Get the ident of the value originally named by the given
84 [string]. Throw [Not_found] if the name doesn't exists on the
85 corresponding [side]. *)
86 val typ : string -> QmlAst.ident
87
88 (** {6 Map setter & getter}*)
89 (** Directly get the map of values *)
90 val get_val_map : ?side: side -> unit -> QmlAst.ident StringMap.t
91
92 (** Directly set the map of values *)
93 val set_val_map : ?side:side -> QmlAst.ident StringMap.t -> unit
94
95 (** Directly set the map of types *)
96 val set_typ_map : QmlAst.ident StringMap.t -> unit
97
98 (** {6 Iterators}*)
99 (** Iter on the map of value.*)
100 val iter_val_map : ?side:side -> (string -> QmlAst.ident -> unit) -> unit
101
102 (** Map on the map of value.*)
103 val map_val_map : ?side:side -> (QmlAst.ident -> 'a) -> 'a StringMap.t
104
105 (** Fold on the map of value.*)
106 val fold_val_map : ?side:side -> (string -> QmlAst.ident -> 'a -> 'a) -> 'a -> 'a
107
108 (** keep the maps only the identifiers satisfying the given predicates
109 this function is applied to the two maps of identifiers (client and server) *)
110 val filter : (Ident.t -> bool) -> unit
111
112 (**
113 Clears the state of this module
114 *)
115 val reset : unit -> unit
Something went wrong with that request. Please try again.