Skip to content
This repository
Newer
Older
100644 82 lines (58 sloc) 2.386 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
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 (**
20 Keys for manipulating bypass in the bsl.
21
22 Since the apparition of the bsl, we use keys instead of row code for bypassing qml compilers by adding some primitives
23 form target languages (ocaml, js, llvm). Primitives need to be registred using the application {b bslregister},
24 which produces some plugins containing the definition of bypass, indexed by their {b keys}.
25
26 @author Mathieu Barbin
27 @author Mehdi Bouaziz
28 *)
29
30 (** {6 Guidelines} *)
31
32 (**
33 Whenever you use a value of type [BslKey.t] in your code,
34 you should use [key] or [bslkey] as variable identifier.
35
36 When you are manipulating a key after a [to_string] manipulation,
37 you should use [skey] as variable identifier.
38
39 {[
40 match expr with
41 | Bypass key ->
42 let skey = BslKey.to_string key in
43 .....
44 ]}
45
46 *)
47
48 (** {6 Standard utilisation} *)
49
50 (** The abstract type of bsl keys.*)
51 type t
52
53 (** comparing 2 keys. returned value as usual compare functions *)
54 val compare : t -> t -> int
55
56 (** Convert a key to a printable representation *)
57 external to_string : t -> string = "%identity"
58
59 val pp : t LangPrint.pprinter
60
61 (** Normalization of key in the Bsl : lowercase, and replace . with '_' *)
62 val normalize : string -> t
63 val normalize_string : string -> string
64
65 (** {6 Internal utilisation} *)
66 (**
67 Not for casual users.
68
69 Since every bypass is normalized, if you transform directly
70 a string into a key, you may not found a bypass because
71 the unnormalized string does not correspond to the normalized one.
72
73 Essentially, this function is used whenever you know that the
74 string has already be normalized.
75 *)
76 external of_string : string -> t = "%identity"
77
78 (** {6 Hash} *)
79
80 val equal : t -> t -> bool
81
82 val hash : t -> int
Something went wrong with that request. Please try again.