author | wenzelm |
Mon, 13 Mar 2023 11:02:26 +0100 | |
changeset 77622 | f458547b4f0f |
parent 76406 | 40a365360680 |
child 78020 | 1a829342a2d3 |
permissions | -rw-r--r-- |
56210 | 1 |
(* Title: Pure/PIDE/session.ML |
52052
892061142ba6
discontinued obsolete isabelle usedir, mkdir, make;
wenzelm
parents:
52050
diff
changeset
|
2 |
Author: Makarius |
6346 | 3 |
|
56210 | 4 |
Prover session: persistent state of logic image. |
6346 | 5 |
*) |
6 |
||
7 |
signature SESSION = |
|
8 |
sig |
|
72640
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
9 |
val init: string -> unit |
60081 | 10 |
val get_name: unit -> string |
6346 | 11 |
val welcome: unit -> string |
59369
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
12 |
val shutdown: unit -> unit |
48457 | 13 |
val finish: unit -> unit |
6346 | 14 |
end; |
15 |
||
16 |
structure Session: SESSION = |
|
17 |
struct |
|
18 |
||
72640
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
19 |
(* session name *) |
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
20 |
|
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
21 |
val session = Synchronized.var "Session.session" ""; |
6346 | 22 |
|
72640
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
23 |
fun init name = Synchronized.change session (K name); |
48542 | 24 |
|
72640
fffad9ad660e
simplified/clarified persistent session information;
wenzelm
parents:
72622
diff
changeset
|
25 |
fun get_name () = Synchronized.value session; |
60081 | 26 |
|
73776 | 27 |
fun description () = (case get_name () of "" => "Isabelle" | name => "Isabelle/" ^ name); |
30173
eabece26b89b
moved isabelle_process.ML, isabelle_process.scala, isar.ML, session.ML to Pure/System/ (together with associated Isar commands);
wenzelm
parents:
29435
diff
changeset
|
28 |
|
73523
2cd23d587db9
further clarification of Isabelle distribution identification -- avoid odd patching of sources;
wenzelm
parents:
72640
diff
changeset
|
29 |
fun welcome () = "Welcome to " ^ description () ^ Isabelle_System.isabelle_heading (); |
6346 | 30 |
|
31 |
||
32 |
(* finish *) |
|
33 |
||
59369
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
34 |
fun shutdown () = |
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
35 |
(Execution.shutdown (); |
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
36 |
Event_Timer.shutdown (); |
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
37 |
Future.shutdown ()); |
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
38 |
|
6346 | 39 |
fun finish () = |
59369
7090199d3f78
more informative build_theories_result: cumulative Runtime.exn_message;
wenzelm
parents:
59345
diff
changeset
|
40 |
(shutdown (); |
72098
8c547eac8381
more robust treatment of thm_names, with strict check after all theories are loaded;
wenzelm
parents:
71611
diff
changeset
|
41 |
Par_List.map (Global_Theory.get_thm_names o Thy_Info.get_theory) (Thy_Info.get_names ()); |
49911
262c36fd5f26
collective errors from use_thys and Session.finish/Goal.finish_futures -- avoid uninformative interrupts stemming from failure of goal forks that are not registered in the theory (e.g. unnamed theorems);
wenzelm
parents:
49895
diff
changeset
|
42 |
Thy_Info.finish (); |
76406
40a365360680
more accurate outer syntax keywords (see also 94b2690ad494): base session could be anything, e.g. ZF vs. HOL;
wenzelm
parents:
73776
diff
changeset
|
43 |
shutdown ()); |
6346 | 44 |
|
45 |
end; |