Skip to content
Newer
Older
100644 81 lines (62 sloc) 2.08 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
19 (**
20 Specific bsl processing for Opa files.
21
22 @author Mathieu Barbin
23 *)
24
25 (**
26 This module implements part of the bslregister process.
27 *)
28 (** *)
29 type filename = string
30 type contents = string
31
32
33 (**
34 Bsl Preprocessing for Opa files.
35
36 Essentially, it is about producing generated declaration.
37 {[
38 ##include functions bslpervasives
39 ]}
40 will produce a code like :
41 {[
42 `+` = %%bslpervasives.add_int%% : int, int -> int
43 ...
44 etc...
45 ]}
46
47 The final bymap should have been built at the end of all registering
48 of bypass, or some inclusion may be unsuccessfull.
49 *)
50 val preprocess :
51 final_bymap:BslLib.BSL.ByPassMap.t -> BslDirectives.opalang_decorated_file -> (filename * FBuffer.t)
52
53
54 type true_means_error = bool
55
56 (**
57 This performs checks on the bsl opa.
58 All errors log are produced using OManager channel.
59
60 It makes no OManager errors, or does not raise any exception,
61 just logs errors using citation if possible,
62 and returns at the end a bool indicating
63 if some errors was encounted during the checking.
64 [true] means errors.
65
66 {[
67 if checking_fail ~final_bymap opa_codes then
68 !! the opa in the bsl is buggy !!
69 else
70 (* everything is ok *)
71 ]}
72
73 The function returns also the typed opa interfaces,
74 produces after typing.
75
76 The filenames should be preserved.
77 *)
78 val checking_fail :
79 final_bymap:BslLib.BSL.ByPassMap.t -> (filename * contents) list ->
80 true_means_error * (filename * FBuffer.t) list
Something went wrong with that request. Please try again.