author | wenzelm |
Fri, 18 Mar 2016 17:58:19 +0100 | |
changeset 62668 | 360d3464919c |
parent 62661 | c23ff2f45a18 |
child 62878 | 1cec457e0a03 |
permissions | -rw-r--r-- |
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
1 |
(* Title: Pure/ML/ml_options.ML |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
3 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
4 |
ML configuration options. |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
5 |
*) |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
6 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
7 |
signature ML_OPTIONS = |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
8 |
sig |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
9 |
val source_trace_raw: Config.raw |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
10 |
val source_trace: bool Config.T |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
11 |
val exception_trace_raw: Config.raw |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
12 |
val exception_trace: bool Config.T |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
13 |
val exception_trace_enabled: Context.generic option -> bool |
62498 | 14 |
val exception_debugger_raw: Config.raw |
15 |
val exception_debugger: bool Config.T |
|
16 |
val exception_debugger_enabled: Context.generic option -> bool |
|
60730 | 17 |
val debugger_raw: Config.raw |
18 |
val debugger: bool Config.T |
|
19 |
val debugger_enabled: Context.generic option -> bool |
|
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
20 |
val print_depth_raw: Config.raw |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
21 |
val print_depth: int Config.T |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
22 |
val get_print_depth: unit -> int |
57834
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
23 |
val get_print_depth_default: int -> int |
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
24 |
end; |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
25 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
26 |
structure ML_Options: ML_OPTIONS = |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
27 |
struct |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
28 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
29 |
(* source trace *) |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
30 |
|
56438 | 31 |
val source_trace_raw = |
32 |
Config.declare ("ML_source_trace", @{here}) (fn _ => Config.Bool false); |
|
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
33 |
val source_trace = Config.bool source_trace_raw; |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
34 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
35 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
36 |
(* exception trace *) |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
37 |
|
56438 | 38 |
val exception_trace_raw = Config.declare_option ("ML_exception_trace", @{here}); |
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
39 |
val exception_trace = Config.bool exception_trace_raw; |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
40 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
41 |
fun exception_trace_enabled NONE = |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
42 |
(Options.default_bool (Config.name_of exception_trace_raw) handle ERROR _ => false) |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
43 |
| exception_trace_enabled (SOME context) = Config.get_generic context exception_trace; |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
44 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
45 |
|
62498 | 46 |
(* exception debugger *) |
47 |
||
48 |
val exception_debugger_raw = Config.declare_option ("ML_exception_debugger", @{here}); |
|
49 |
val exception_debugger = Config.bool exception_debugger_raw; |
|
50 |
||
51 |
fun exception_debugger_enabled NONE = |
|
52 |
(Options.default_bool (Config.name_of exception_debugger_raw) handle ERROR _ => false) |
|
53 |
| exception_debugger_enabled (SOME context) = Config.get_generic context exception_debugger; |
|
54 |
||
55 |
||
60730 | 56 |
(* debugger *) |
57 |
||
58 |
val debugger_raw = Config.declare_option ("ML_debugger", @{here}); |
|
59 |
val debugger = Config.bool debugger_raw; |
|
60 |
||
61 |
fun debugger_enabled NONE = |
|
62 |
(Options.default_bool (Config.name_of debugger_raw) handle ERROR _ => false) |
|
63 |
| debugger_enabled (SOME context) = Config.get_generic context debugger; |
|
64 |
||
65 |
||
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
66 |
(* print depth *) |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
67 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
68 |
val print_depth_raw = |
62661 | 69 |
Config.declare ("ML_print_depth", @{here}) (fn _ => Config.Int (ML_Pretty.get_print_depth ())); |
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
70 |
val print_depth = Config.int print_depth_raw; |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
71 |
|
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
72 |
fun get_print_depth () = |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
73 |
(case Context.thread_data () of |
62661 | 74 |
NONE => ML_Pretty.get_print_depth () |
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
75 |
| SOME context => Config.get_generic context print_depth); |
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
76 |
|
57834
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
77 |
fun get_print_depth_default default = |
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
78 |
(case Context.thread_data () of |
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
79 |
NONE => default |
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
80 |
| SOME context => Config.get_generic context print_depth); |
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
wenzelm
parents:
56438
diff
changeset
|
81 |
|
56303
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
wenzelm
parents:
diff
changeset
|
82 |
end; |