Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 74 lines (56 sloc) 2.264 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 (* CF mli *)
19
20 let generic_make_property printer start ?(quiet=false) mess =
21 let t = ref start in
22 let set state =
23 t := state ;
24 if not quiet then printer mess state
25 and get () = !t
26 in
27 set, get
28
29 let make_property ?(start=false) =
30 generic_make_property
31 (fun mess state ->
32 OManager.unquiet "%s is %s@\n" mess (if state then "on" else "off"))
33 start
34
35 let make_int_property ?(start=0) =
36 generic_make_property
37 (fun mess state ->
38 OManager.unquiet "%s level is %d@\n" mess state)
39 start
40
41 let assert_set, assert_get = make_property ~start:true "assert"
42 let dddbgen_set, dddbgen_get = make_property "dddbgen"
43 let dump_set, dump_get = make_property "dump" ~quiet:true
44 let greedy_set, greedy_get = make_property "greedy" ~quiet:true
45 let noeval_set, noeval_get = make_property "noeval" ~quiet:true
46
47 let prompt_set, prompt_get = make_property ~start:false ~quiet:true "prompt"
48
49 let restricted_bypass_set, restricted_bypass_get =
50 make_property ~start:true "restricted_bypass"
51
52 let value_restriction_set, value_restriction_get = (*make_int_property "value_restriction" ~quiet:false*)
53 generic_make_property
54 (fun mess state ->
55 OManager.unquiet "%s is %s@\n"
56 mess (match state with
57 | `disabled -> "disabled"
58 | `normal -> "normal"
59 | `strict -> "strict"))
60 `disabled
61 ~quiet:true
62 "value_restriction"
63
64
65
66 let switch_typechecker ty_ch_name =
67 match QmlTyper.available_typer_of_string ty_ch_name with
68 | None -> false
69 | Some t -> QmlTyper.DyTyper.switch_typer t ; true
70
71
72
73 let stdout = ref Format.std_formatter
Something went wrong with that request. Please try again.