author | wenzelm |
Wed, 08 Aug 2012 14:30:27 +0200 | |
changeset 48734 | af91cd2301ba |
parent 48731 | a45ba78abcc1 |
child 48804 | 6348e5fca42e |
permissions | -rw-r--r-- |
48418 | 1 |
(* Title: Pure/System/build.ML |
2 |
Author: Makarius |
|
3 |
||
4 |
Build Isabelle sessions. |
|
5 |
*) |
|
6 |
||
7 |
signature BUILD = |
|
8 |
sig |
|
48731
a45ba78abcc1
more casual exit back to ML toplevel, to accomodate commit in SML/NJ which continues at the saved point;
wenzelm
parents:
48681
diff
changeset
|
9 |
val build: string -> unit |
48418 | 10 |
end; |
11 |
||
12 |
structure Build: BUILD = |
|
13 |
struct |
|
14 |
||
48465 | 15 |
local |
16 |
||
48500 | 17 |
fun no_document options = |
18 |
(case Options.string options "document" of "" => true | "false" => true | _ => false) andalso |
|
19 |
(Options.string options "document_dump" = ""); |
|
20 |
||
48465 | 21 |
fun use_thys options = |
48457 | 22 |
Thy_Info.use_thys |
23 |
|> Unsynchronized.setmp Proofterm.proofs (Options.int options "proofs") |
|
24 |
|> Unsynchronized.setmp print_mode |
|
25 |
(space_explode "," (Options.string options "print_mode") @ print_mode_value ()) |
|
26 |
|> Unsynchronized.setmp Goal.parallel_proofs (Options.int options "parallel_proofs") |
|
27 |
|> Unsynchronized.setmp Goal.parallel_proofs_threshold |
|
28 |
(Options.int options "parallel_proofs_threshold") |
|
29 |
|> Unsynchronized.setmp Multithreading.trace (Options.int options "threads_trace") |
|
48460 | 30 |
|> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads") |
48500 | 31 |
|> no_document options ? Present.no_document |
48486 | 32 |
|> Unsynchronized.setmp quick_and_dirty (Options.bool options "quick_and_dirty") |
48634 | 33 |
|> Unsynchronized.setmp Toplevel.skip_proofs (Options.bool options "skip_proofs") |
48486 | 34 |
|> Unsynchronized.setmp Printer.show_question_marks_default |
35 |
(Options.bool options "show_question_marks") |
|
36 |
|> Unsynchronized.setmp Name_Space.names_long_default (Options.bool options "names_long") |
|
37 |
|> Unsynchronized.setmp Name_Space.names_short_default (Options.bool options "names_short") |
|
48492 | 38 |
|> Unsynchronized.setmp Name_Space.names_unique_default (Options.bool options "names_unique") |
48520 | 39 |
|> Unsynchronized.setmp Thy_Output.display_default (Options.bool options "thy_output_display") |
40 |
|> Unsynchronized.setmp Thy_Output.quotes_default (Options.bool options "thy_output_quotes") |
|
41 |
|> Unsynchronized.setmp Thy_Output.indent_default (Options.int options "thy_output_indent") |
|
42 |
|> Unsynchronized.setmp Thy_Output.source_default (Options.bool options "thy_output_source") |
|
43 |
|> Unsynchronized.setmp Thy_Output.break_default (Options.bool options "thy_output_break") |
|
48527 | 44 |
|> Unsynchronized.setmp Pretty.margin_default (Options.int options "pretty_margin") |
48492 | 45 |
|> Unsynchronized.setmp Toplevel.timing (Options.bool options "timing"); |
48457 | 46 |
|
48465 | 47 |
fun use_theories (options, thys) = |
48 |
let val condition = space_explode "," (Options.string options "condition") in |
|
49 |
(case filter_out (can getenv_strict) condition of |
|
50 |
[] => use_thys options thys |
|
51 |
| conds => |
|
48512 | 52 |
Output.physical_stderr ("Skipping theories " ^ commas_quote thys ^ |
48477 | 53 |
" (undefined " ^ commas conds ^ ")\n")) |
48465 | 54 |
end; |
55 |
||
56 |
in |
|
57 |
||
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
48673
diff
changeset
|
58 |
fun build args_file = Command_Line.tool (fn () => |
48672
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
59 |
let |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
60 |
val (do_output, (options, (verbose, (browser_info, (parent_name, |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
61 |
(name, theories)))))) = |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
62 |
File.read (Path.explode args_file) |> YXML.parse_body |> |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
63 |
let open XML.Decode in |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
64 |
pair bool (pair Options.decode (pair bool (pair string (pair string |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
65 |
(pair string ((list (pair Options.decode (list string))))))))) |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
66 |
end; |
48418 | 67 |
|
48672
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
68 |
val _ = |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
69 |
Session.init do_output false |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
70 |
(Options.bool options "browser_info") browser_info |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
71 |
(Options.string options "document") |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
72 |
(Options.bool options "document_graph") |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
73 |
(space_explode ":" (Options.string options "document_variants")) |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
74 |
parent_name name |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
75 |
(Options.string options "document_dump", |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
76 |
Present.dump_mode (Options.string options "document_dump_mode")) |
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
77 |
"" verbose; |
48673
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
78 |
val _ = |
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
79 |
theories |> |
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
80 |
(List.app use_theories |
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
81 |
|> Session.with_timing name verbose |
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
82 |
|> Unsynchronized.setmp Multithreading.max_threads (Options.int options "threads")); |
b2b09970c571
let with_timing report overall number of threads;
wenzelm
parents:
48672
diff
changeset
|
83 |
|
48672
9bc7922ba2ae
further robustification of interrupts during build;
wenzelm
parents:
48662
diff
changeset
|
84 |
val _ = Session.finish (); |
48734
af91cd2301ba
back to implicit commit via isabelle-process -- save image only once (cf. 181b91e1d1c1);
wenzelm
parents:
48731
diff
changeset
|
85 |
val _ = if do_output then () else exit 0; |
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
48673
diff
changeset
|
86 |
in 0 end); |
48418 | 87 |
|
88 |
end; |
|
48465 | 89 |
|
90 |
end; |