18 struct |
18 struct |
19 |
19 |
20 |
20 |
21 (* session state *) |
21 (* session state *) |
22 |
22 |
23 val pure = "Pure"; |
23 val session = ref ([Sign.PureN]: string list); |
24 |
|
25 val session = ref ([pure]: string list); |
|
26 val session_path = ref ([]: string list); |
24 val session_path = ref ([]: string list); |
27 val session_finished = ref false; |
25 val session_finished = ref false; |
28 val rpath = ref (NONE: Url.T option); |
26 val remote_path = ref (NONE: Url.T option); |
29 |
27 |
30 |
28 |
31 (* access path *) |
29 (* access path *) |
32 |
30 |
33 fun path () = ! session_path; |
31 fun path () = ! session_path; |
34 |
32 |
35 fun str_of [] = pure |
33 fun str_of [] = Sign.PureN |
36 | str_of elems = space_implode "/" elems; |
34 | str_of elems = space_implode "/" elems; |
37 |
35 |
38 fun name () = "Isabelle/" ^ str_of (path ()); |
36 fun name () = "Isabelle/" ^ str_of (path ()); |
39 fun welcome () = "Welcome to " ^ name () ^ " (" ^ version ^ ")"; |
37 fun welcome () = "Welcome to " ^ name () ^ " (" ^ version ^ ")"; |
40 |
38 |
65 session_finished := true); |
63 session_finished := true); |
66 |
64 |
67 |
65 |
68 (* use_dir *) |
66 (* use_dir *) |
69 |
67 |
70 (* |
|
71 val root_file = ThyLoad.ml_path "ROOT"; |
|
72 *) |
|
73 |
|
74 fun get_rpath rpath_str = |
68 fun get_rpath rpath_str = |
75 (if rpath_str = "" then () else |
69 (if rpath_str = "" then () else |
76 if is_some (! rpath) then |
70 if is_some (! remote_path) then |
77 error "Path for remote theory browsing information may only be set once" |
71 error "Path for remote theory browsing information may only be set once" |
78 else |
72 else |
79 rpath := SOME (Url.unpack rpath_str); |
73 remote_path := SOME (Url.unpack rpath_str); |
80 (!rpath, rpath_str <> "")); |
74 (! remote_path, rpath_str <> "")); |
81 |
75 |
82 fun use_dir root_file build modes reset info doc doc_graph parent name dump rpath_str level verbose hide = |
76 fun use_dir root build modes reset info doc doc_graph parent name dump rpath_str level verbose hide = |
83 Library.setmp print_mode (modes @ ! print_mode) |
77 Library.setmp print_mode (modes @ ! print_mode) |
84 (Library.setmp Proofterm.proofs level (Library.setmp IsarOutput.hide_commands hide (fn () => |
78 (Library.setmp Proofterm.proofs level (Library.setmp IsarOutput.hide_commands hide (fn () => |
85 (init reset parent name; |
79 (init reset parent name; |
86 Present.init build info doc doc_graph (path ()) name |
80 Present.init build info doc doc_graph (path ()) name |
87 (if dump = "" then NONE else SOME (Path.unpack dump)) (get_rpath rpath_str) verbose; |
81 (if dump = "" then NONE else SOME (Path.unpack dump)) (get_rpath rpath_str) verbose; |
88 File.use (Path.basic root_file); |
82 File.use (Path.basic root); |
89 finish ())))) () |
83 finish ())))) () |
90 handle exn => (writeln (Toplevel.exn_message exn); exit 1); |
84 handle exn => (writeln (Toplevel.exn_message exn); exit 1); |
91 |
85 |
92 |
86 |
93 end; |
87 end; |