| author | haftmann | 
| Mon, 07 Dec 2015 10:49:08 +0100 | |
| changeset 61823 | 5daa82ba4078 | 
| parent 60730 | 02c2860fcf30 | 
| child 62498 | 5dfcc9697f29 | 
| 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  | 
| 60730 | 14  | 
val debugger_raw: Config.raw  | 
15  | 
val debugger: bool Config.T  | 
|
16  | 
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
 | 
17  | 
val print_depth_raw: Config.raw  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
18  | 
val print_depth: int Config.T  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
19  | 
val get_print_depth: unit -> int  | 
| 
57834
 
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
 
wenzelm 
parents: 
56438 
diff
changeset
 | 
20  | 
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
 | 
21  | 
end;  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
22  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
23  | 
structure ML_Options: ML_OPTIONS =  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
24  | 
struct  | 
| 
 
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  | 
(* source trace *)  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
27  | 
|
| 56438 | 28  | 
val source_trace_raw =  | 
29  | 
  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
 | 
30  | 
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
 | 
31  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
32  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
33  | 
(* exception trace *)  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
34  | 
|
| 56438 | 35  | 
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
 | 
36  | 
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
 | 
37  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
38  | 
fun exception_trace_enabled NONE =  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
39  | 
(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
 | 
40  | 
| 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
 | 
41  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
42  | 
|
| 60730 | 43  | 
(* debugger *)  | 
44  | 
||
45  | 
val debugger_raw = Config.declare_option ("ML_debugger", @{here});
 | 
|
46  | 
val debugger = Config.bool debugger_raw;  | 
|
47  | 
||
48  | 
fun debugger_enabled NONE =  | 
|
49  | 
(Options.default_bool (Config.name_of debugger_raw) handle ERROR _ => false)  | 
|
50  | 
| debugger_enabled (SOME context) = Config.get_generic context debugger;  | 
|
51  | 
||
52  | 
||
| 
56303
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
53  | 
(* print depth *)  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
54  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
55  | 
val print_depth_raw =  | 
| 56438 | 56  | 
  Config.declare ("ML_print_depth", @{here}) (fn _ => Config.Int (get_default_print_depth ()));
 | 
| 
56303
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
57  | 
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
 | 
58  | 
|
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
59  | 
fun get_print_depth () =  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
60  | 
(case Context.thread_data () of  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
61  | 
NONE => get_default_print_depth ()  | 
| 
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
62  | 
| 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
 | 
63  | 
|
| 
57834
 
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
 
wenzelm 
parents: 
56438 
diff
changeset
 | 
64  | 
fun get_print_depth_default default =  | 
| 
 
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
 
wenzelm 
parents: 
56438 
diff
changeset
 | 
65  | 
(case Context.thread_data () of  | 
| 
 
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
 
wenzelm 
parents: 
56438 
diff
changeset
 | 
66  | 
NONE => default  | 
| 
 
0d295e339f52
prefer dynamic ML_print_depth if context happens to be available;
 
wenzelm 
parents: 
56438 
diff
changeset
 | 
67  | 
| 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
 | 
68  | 
|
| 
56303
 
4cc3f4db3447
clarified Isabelle/ML bootstrap, such that Execution does not require ML_Compiler;
 
wenzelm 
parents:  
diff
changeset
 | 
69  | 
end;  |