author | wenzelm |
Sat, 15 Mar 2014 11:22:25 +0100 | |
changeset 56158 | c2c6d560e7b2 |
parent 55387 | 51f0876f61df |
child 56208 | 06cc31dff138 |
permissions | -rw-r--r-- |
52009 | 1 |
(* Title: Pure/Tools/proof_general.ML |
52006 | 2 |
Author: David Aspinall |
3 |
Author: Makarius |
|
21642 | 4 |
|
52006 | 5 |
Isabelle/Isar configuration for Proof General / Emacs. |
26549 | 6 |
See also http://proofgeneral.inf.ed.ac.uk |
21642 | 7 |
*) |
8 |
||
53403
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
52852
diff
changeset
|
9 |
(*Proof General legacy*) |
c09f4005d6bd
some explicit indication of Proof General legacy;
wenzelm
parents:
52852
diff
changeset
|
10 |
|
21642 | 11 |
signature PROOF_GENERAL = |
12 |
sig |
|
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
13 |
type category = string |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
14 |
val category_display: category |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
15 |
val category_advanced_display: category |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
16 |
val category_tracing: category |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
17 |
val category_proof: category |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
18 |
type pgiptype = string |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
19 |
val pgipbool: pgiptype |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
20 |
val pgipint: pgiptype |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
21 |
val pgipfloat: pgiptype |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
22 |
val pgipstring: pgiptype |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
23 |
val preference: category -> string option -> |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
24 |
(unit -> string) -> (string -> unit) -> string -> string -> string -> unit |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
25 |
val preference_bool: category -> string option -> |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
26 |
bool Unsynchronized.ref -> string -> string -> unit |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
27 |
val preference_int: category -> string option -> |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
28 |
int Unsynchronized.ref -> string -> string -> unit |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
29 |
val preference_real: category -> string option -> |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
30 |
real Unsynchronized.ref -> string -> string -> unit |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
31 |
val preference_string: category -> string option -> |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
32 |
string Unsynchronized.ref -> string -> string -> unit |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
33 |
val preference_option: category -> string option -> string -> string -> string -> unit |
52437
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
34 |
val process_pgip: string -> unit |
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
35 |
val tell_clear_goals: unit -> unit |
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
36 |
val tell_clear_response: unit -> unit |
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
37 |
val inform_file_processed: string -> unit |
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
38 |
val inform_file_retracted: string -> unit |
54450
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
39 |
val master_path: Path.T Unsynchronized.ref |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
40 |
structure ThyLoad: sig val add_path: string -> unit end |
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
41 |
val thm_deps: bool Unsynchronized.ref |
52013 | 42 |
val proof_generalN: string |
51938 | 43 |
val init: unit -> unit |
52437
c88354589b43
more formal ProofGeneral command setup within theory Pure;
wenzelm
parents:
52017
diff
changeset
|
44 |
val restart: unit -> unit |
21642 | 45 |
end; |
46 |
||
47 |
structure ProofGeneral: PROOF_GENERAL = |
|
48 |
struct |
|
49 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
50 |
(** preferences **) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
51 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
52 |
(* type preference *) |
52006 | 53 |
|
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
54 |
type category = string; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
55 |
val category_display = "Display"; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
56 |
val category_advanced_display = "Advanced Display"; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
57 |
val category_tracing = "Tracing"; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
58 |
val category_proof = "Proof"; |
52006 | 59 |
|
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
60 |
type pgiptype = string; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
61 |
val pgipbool = "pgipbool"; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
62 |
val pgipint = "pgipint"; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
63 |
val pgipfloat = "pgipint"; (*NB: PG 3.7.x and 4.0 lack pgipfloat, but accept floats as pgipint*) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
64 |
val pgipstring = "pgipstring"; |
52006 | 65 |
|
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
66 |
type preference = |
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
67 |
{category: string, |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
68 |
override: string option, |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
69 |
descr: string, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
70 |
pgiptype: pgiptype, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
71 |
get: unit -> string, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
72 |
set: string -> unit}; |
52006 | 73 |
|
74 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
75 |
(* global preferences *) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
76 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
77 |
local |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
78 |
val preferences = |
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
79 |
Synchronized.var "ProofGeneral.preferences" ([]: (string * preference) list); |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
80 |
in |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
81 |
|
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
82 |
fun add_preference name pref = |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
83 |
Synchronized.change preferences (fn prefs => |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
84 |
(if not (AList.defined (op =) prefs name) then () |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
85 |
else warning ("Redefining ProofGeneral preference: " ^ quote name); |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
86 |
AList.update (op =) (name, pref) prefs)); |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
87 |
|
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
88 |
fun set_preference name value = |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
89 |
(case AList.lookup (op =) (Synchronized.value preferences) name of |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
90 |
SOME {set, ...} => set value |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
91 |
| NONE => error ("Unknown ProofGeneral preference: " ^ quote name)); |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
92 |
|
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
93 |
fun all_preferences () = |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
94 |
rev (Synchronized.value preferences) |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
95 |
|> map (fn (name, {category, descr, pgiptype, get, ...}) => |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
96 |
(category, {name = name, descr = descr, default = get (), pgiptype = pgiptype})) |
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
97 |
|> AList.group (op =); |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
98 |
|
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
99 |
fun init_preferences () = |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
100 |
Synchronized.value preferences |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
101 |
|> List.app (fn (_, {set, override = SOME value, ...}) => set value | _ => ()); |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
102 |
|
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
103 |
end; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
104 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
105 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
106 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
107 |
(* raw preferences *) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
108 |
|
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
109 |
fun preference category override get set typ name descr = |
52016
4b77f444afbb
simplified ProofGeneral.preference operation -- no need for CRITICAL section for atomic access (and sequential execution of PG/TTY loop);
wenzelm
parents:
52015
diff
changeset
|
110 |
add_preference name |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
111 |
{category = category, override = override, descr = descr, pgiptype = typ, get = get, set = set}; |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
112 |
|
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
113 |
fun preference_ref category override read write typ r = |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
114 |
preference category override (fn () => read (! r)) (fn x => r := write x) typ; |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
115 |
|
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
116 |
fun preference_bool x y = preference_ref x y Markup.print_bool Markup.parse_bool pgipbool; |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
117 |
fun preference_int x y = preference_ref x y Markup.print_int Markup.parse_int pgipint; |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
118 |
fun preference_real x y = preference_ref x y Markup.print_real Markup.parse_real pgipfloat; |
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
119 |
fun preference_string x y = preference_ref x y I I pgipstring; |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
120 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
121 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
122 |
(* system options *) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
123 |
|
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
124 |
fun preference_option category override option_name pgip_name descr = |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
125 |
let |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
126 |
val typ = Options.default_typ option_name; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
127 |
val pgiptype = |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
128 |
if typ = Options.boolT then pgipbool |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
129 |
else if typ = Options.intT then pgipint |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
130 |
else if typ = Options.realT then pgipfloat |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
131 |
else pgipstring; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
132 |
in |
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
133 |
add_preference pgip_name |
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
134 |
{category = category, |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
135 |
override = override, |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
136 |
descr = descr, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
137 |
pgiptype = pgiptype, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
138 |
get = fn () => Options.get_default option_name, |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
139 |
set = Options.put_default option_name} |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
140 |
end; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
141 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
142 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
143 |
(* minimal PGIP support for <askprefs>, <haspref>, <setpref> *) |
52006 | 144 |
|
145 |
local |
|
146 |
||
147 |
fun get_attr attrs name = |
|
148 |
(case Properties.get attrs name of |
|
149 |
SOME value => value |
|
150 |
| NONE => raise Fail ("Missing attribute: " ^ quote name)); |
|
151 |
||
152 |
fun attr x y = [(x, y)] : XML.attributes; |
|
153 |
||
154 |
fun opt_attr _ NONE = [] |
|
155 |
| opt_attr name (SOME value) = attr name value; |
|
156 |
||
157 |
val pgip_id = "dummy"; |
|
52537 | 158 |
val pgip_serial = Counter.make (); |
52006 | 159 |
|
160 |
fun output_pgip refid refseq content = |
|
161 |
XML.Elem (("pgip", |
|
162 |
attr "tag" "Isabelle/Isar" @ |
|
163 |
attr "id" pgip_id @ |
|
164 |
opt_attr "destid" refid @ |
|
165 |
attr "class" "pg" @ |
|
166 |
opt_attr "refid" refid @ |
|
167 |
attr "refseq" refseq @ |
|
168 |
attr "seq" (string_of_int (pgip_serial ()))), content) |
|
169 |
|> XML.string_of |
|
170 |
|> Output.urgent_message; |
|
171 |
||
172 |
||
173 |
fun invalid_pgip () = raise Fail "Invalid PGIP packet"; |
|
174 |
||
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
175 |
fun haspref {name, descr, default, pgiptype} = |
52006 | 176 |
XML.Elem (("haspref", [("name", name), ("descr", descr), ("default", default)]), |
177 |
[XML.Elem ((pgiptype, []), [])]); |
|
178 |
||
179 |
fun process_element refid refseq (XML.Elem (("askprefs", _), _)) = |
|
52014
45929e0e1d73
more standard Isabelle/ML structures for global preferences;
wenzelm
parents:
52013
diff
changeset
|
180 |
all_preferences () |> List.app (fn (category, prefs) => |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
181 |
output_pgip refid refseq |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
182 |
[XML.Elem (("hasprefs", [("prefcategory", category)]), map haspref prefs)]) |
52006 | 183 |
| process_element _ _ (XML.Elem (("setpref", attrs), data)) = |
184 |
let |
|
185 |
val name = |
|
186 |
(case Properties.get attrs "name" of |
|
187 |
SOME name => name |
|
188 |
| NONE => invalid_pgip ()); |
|
189 |
val value = XML.content_of data; |
|
190 |
in set_preference name value end |
|
191 |
| process_element _ _ _ = invalid_pgip (); |
|
192 |
||
193 |
in |
|
194 |
||
195 |
fun process_pgip str = |
|
196 |
(case XML.parse str of |
|
197 |
XML.Elem (("pgip", attrs), pgips) => |
|
198 |
let |
|
199 |
val class = get_attr attrs "class"; |
|
200 |
val dest = Properties.get attrs "destid"; |
|
201 |
val refid = Properties.get attrs "id"; |
|
202 |
val refseq = get_attr attrs "seq"; |
|
203 |
val processit = |
|
204 |
(case dest of |
|
205 |
NONE => class = "pa" |
|
206 |
| SOME id => id = pgip_id); |
|
207 |
in if processit then List.app (process_element refid refseq) pgips else () end |
|
208 |
| _ => invalid_pgip ()) |
|
209 |
handle Fail msg => raise Fail (msg ^ "\n" ^ str); |
|
210 |
||
211 |
end; |
|
212 |
||
213 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
214 |
(** messages **) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
215 |
|
51939 | 216 |
(* render markup *) |
26549 | 217 |
|
43777 | 218 |
fun special ch = chr 1 ^ ch; |
21642 | 219 |
|
220 |
local |
|
221 |
||
29326 | 222 |
fun render_trees ts = fold render_tree ts |
49658 | 223 |
and render_tree t = |
224 |
(case XML.unwrap_elem t of |
|
225 |
SOME (_, ts) => render_trees ts |
|
226 |
| NONE => |
|
227 |
(case t of |
|
228 |
XML.Text s => Buffer.add s |
|
229 |
| XML.Elem ((name, props), ts) => |
|
230 |
let |
|
51939 | 231 |
val (bg, en) = |
49658 | 232 |
if null ts then Markup.no_output |
50201
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
233 |
else if name = Markup.stateN then (special "O" ^ "\n", "\n" ^ special "P") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
234 |
else if name = Markup.sendbackN then (special "W", special "X") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
235 |
else if name = Markup.intensifyN then (special "0", special "1") |
52643
34c29356930e
more explicit Markup.information for messages produced by "auto" tools;
wenzelm
parents:
52537
diff
changeset
|
236 |
else if name = Markup.informationN then ("\n" ^ special "0", special "1") |
50201
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
237 |
else if name = Markup.tfreeN then (special "C", special "A") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
238 |
else if name = Markup.tvarN then (special "D", special "A") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
239 |
else if name = Markup.freeN then (special "E", special "A") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
240 |
else if name = Markup.boundN then (special "F", special "A") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
241 |
else if name = Markup.varN then (special "G", special "A") |
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
242 |
else if name = Markup.skolemN then (special "H", special "A") |
49658 | 243 |
else |
50201
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
244 |
(case Markup.get_entity_kind (name, props) of |
49658 | 245 |
SOME kind => |
50201
c26369c9eda6
Isabelle-specific implementation of quasi-abstract markup elements -- back to module arrangement before d83797ef0d2d;
wenzelm
parents:
50163
diff
changeset
|
246 |
if kind = Markup.classN then (special "B", special "A") |
49658 | 247 |
else Markup.no_output |
248 |
| NONE => Markup.no_output); |
|
51939 | 249 |
in Buffer.add bg #> render_trees ts #> Buffer.add en end)); |
21642 | 250 |
|
251 |
in |
|
252 |
||
29326 | 253 |
fun render text = |
254 |
Buffer.content (render_trees (YXML.parse_body text) Buffer.empty); |
|
21642 | 255 |
|
256 |
end; |
|
257 |
||
258 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
259 |
(* hooks *) |
29326 | 260 |
|
261 |
fun message bg en prfx text = |
|
262 |
(case render text of |
|
263 |
"" => () |
|
44389
a3b5fdfb04a3
tuned signature -- contrast physical output primitives versus Output.raw_message;
wenzelm
parents:
44270
diff
changeset
|
264 |
| s => Output.physical_writeln (enclose bg en (prefix_lines prfx s))); |
23641
d6f9d3acffaa
toplevel prompt/print_state: proper markup, removed hooks;
wenzelm
parents:
23621
diff
changeset
|
265 |
|
29326 | 266 |
fun setup_messages () = |
55387
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
267 |
(Output.writeln_fn := message "" "" ""; |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
268 |
Output.status_fn := (fn _ => ()); |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
269 |
Output.report_fn := (fn _ => ()); |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
270 |
Output.urgent_message_fn := message (special "I") (special "J") ""; |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
271 |
Output.tracing_fn := message (special "I" ^ special "V") (special "J") ""; |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
272 |
Output.warning_fn := message (special "K") (special "L") "### "; |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
273 |
Output.error_message_fn := (fn (_, s) => message (special "M") (special "N") "*** " s); |
51f0876f61df
seal system channels at end of Pure bootstrap -- Isabelle/Scala provides official interfaces;
wenzelm
parents:
54450
diff
changeset
|
274 |
Output.prompt_fn := (fn s => Output.physical_stdout (render s ^ special "S"))); |
29326 | 275 |
|
23641
d6f9d3acffaa
toplevel prompt/print_state: proper markup, removed hooks;
wenzelm
parents:
23621
diff
changeset
|
276 |
|
29326 | 277 |
(* notification *) |
21642 | 278 |
|
29326 | 279 |
val emacs_notify = message (special "I") (special "J") ""; |
21642 | 280 |
|
281 |
fun tell_clear_goals () = |
|
21940 | 282 |
emacs_notify "Proof General, please clear the goals buffer."; |
21642 | 283 |
|
284 |
fun tell_clear_response () = |
|
21940 | 285 |
emacs_notify "Proof General, please clear the response buffer."; |
21642 | 286 |
|
287 |
fun tell_file_loaded path = |
|
21940 | 288 |
emacs_notify ("Proof General, this file is loaded: " ^ quote (File.platform_path path)); |
21642 | 289 |
|
290 |
fun tell_file_retracted path = |
|
21940 | 291 |
emacs_notify ("Proof General, you can unlock the file " ^ quote (File.platform_path path)); |
21642 | 292 |
|
293 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
294 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
295 |
(** theory loader **) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
296 |
|
54450
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
297 |
(* global master path *) |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
298 |
|
54450
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
299 |
val master_path = Unsynchronized.ref Path.current; |
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
300 |
|
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
301 |
(*fake old ThyLoad -- with new semantics*) |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
302 |
structure ThyLoad = |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
303 |
struct |
54450
7815563f50dc
tuned signature -- clarified Proof General legacy;
wenzelm
parents:
54387
diff
changeset
|
304 |
fun add_path path = master_path := Path.explode path; |
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
305 |
end; |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
306 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
307 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
308 |
(* actions *) |
21642 | 309 |
|
310 |
local |
|
311 |
||
312 |
fun trace_action action name = |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36953
diff
changeset
|
313 |
if action = Thy_Info.Update then |
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36953
diff
changeset
|
314 |
List.app tell_file_loaded (Thy_Info.loaded_files name) |
37981
9a15982f41fe
theory loader: removed obsolete touch/outdate operations (require_thy no longer changes the database implicitly);
wenzelm
parents:
37977
diff
changeset
|
315 |
else if action = Thy_Info.Remove then |
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36953
diff
changeset
|
316 |
List.app tell_file_retracted (Thy_Info.loaded_files name) |
21642 | 317 |
else (); |
318 |
||
319 |
in |
|
37216
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36953
diff
changeset
|
320 |
fun setup_thy_loader () = Thy_Info.add_hook trace_action; |
3165bc303f66
modernized some structure names, keeping a few legacy aliases;
wenzelm
parents:
36953
diff
changeset
|
321 |
fun sync_thy_loader () = List.app (trace_action Thy_Info.Update) (Thy_Info.get_names ()); |
21642 | 322 |
end; |
323 |
||
324 |
||
21948 | 325 |
(* get informed about files *) |
21642 | 326 |
|
25442 | 327 |
(*liberal low-level version*) |
328 |
val thy_name = perhaps (try (unsuffix ".thy")) o List.last o space_explode "/"; |
|
329 |
||
37977
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37954
diff
changeset
|
330 |
val inform_file_retracted = Thy_Info.kill_thy o thy_name; |
25442 | 331 |
|
27577
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
332 |
fun inform_file_processed file = |
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
333 |
let |
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
334 |
val name = thy_name file; |
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
335 |
val _ = name = "" andalso error ("Bad file name: " ^ quote file); |
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
336 |
val _ = |
37977
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37954
diff
changeset
|
337 |
Thy_Info.register_thy (Toplevel.end_theory Position.none (Isar.state ())) |
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37954
diff
changeset
|
338 |
handle ERROR msg => |
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37954
diff
changeset
|
339 |
(warning (cat_lines ["Failed to register theory: " ^ quote name, msg]); |
46737 | 340 |
tell_file_retracted (Thy_Load.thy_path (Path.basic name))) |
29349 | 341 |
val _ = Isar.init (); |
27577
7c7a9a343ca5
proper_inform_file_processed: new implementation based on global Isar state (cf. isar.ML);
wenzelm
parents:
27537
diff
changeset
|
342 |
in () end; |
21642 | 343 |
|
344 |
||
345 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
346 |
(** theorem dependencies **) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
347 |
|
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
348 |
(* thm_deps *) |
51970 | 349 |
|
350 |
local |
|
351 |
||
352 |
fun add_proof_body (PBody {thms, ...}) = |
|
353 |
thms |> fold (fn (_, (name, _, _)) => name <> "" ? Symtab.update (name, ())); |
|
21642 | 354 |
|
51970 | 355 |
fun add_thm th = |
356 |
(case Thm.proof_body_of th of |
|
357 |
PBody {proof = PThm (_, ((name, _, _), body)), ...} => |
|
358 |
if Thm.has_name_hint th andalso Thm.get_name_hint th = name |
|
359 |
then add_proof_body (Future.join body) |
|
360 |
else I |
|
361 |
| body => add_proof_body body); |
|
362 |
||
363 |
in |
|
364 |
||
52011 | 365 |
fun get_thm_deps ths = |
51970 | 366 |
let |
367 |
(* FIXME proper derivation names!? *) |
|
368 |
val names = map Thm.get_name_hint (filter Thm.has_name_hint ths); |
|
369 |
val deps = Symtab.keys (fold add_thm ths Symtab.empty); |
|
370 |
in (names, deps) end; |
|
371 |
||
372 |
end; |
|
373 |
||
374 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
375 |
(* report via hook *) |
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
376 |
|
52011 | 377 |
val thm_deps = Unsynchronized.ref false; |
51939 | 378 |
|
21642 | 379 |
local |
380 |
||
381 |
val spaces_quote = space_implode " " o map quote; |
|
382 |
||
383 |
fun thm_deps_message (thms, deps) = |
|
21948 | 384 |
emacs_notify ("Proof General, theorem dependencies of " ^ thms ^ " are " ^ deps); |
21642 | 385 |
|
28096
046418f64474
theorem dependency output: Toplevel.add_hook, ProofGeneralPgip.new_thms_deps;
wenzelm
parents:
28020
diff
changeset
|
386 |
in |
046418f64474
theorem dependency output: Toplevel.add_hook, ProofGeneralPgip.new_thms_deps;
wenzelm
parents:
28020
diff
changeset
|
387 |
|
28103
b79e61861f0f
simplified Toplevel.add_hook: cover successful transactions only;
wenzelm
parents:
28100
diff
changeset
|
388 |
fun setup_present_hook () = Toplevel.add_hook (fn _ => fn state => fn state' => |
52011 | 389 |
if ! thm_deps andalso can Toplevel.theory_of state andalso Toplevel.is_theory state' |
28106 | 390 |
then |
51970 | 391 |
let |
392 |
val prev_facts = Global_Theory.facts_of (Toplevel.theory_of state); |
|
393 |
val facts = Global_Theory.facts_of (Toplevel.theory_of state'); |
|
56158
c2c6d560e7b2
more explicit treatment of verbose mode, which includes concealed entries;
wenzelm
parents:
55387
diff
changeset
|
394 |
val (names, deps) = get_thm_deps (maps #2 (Facts.dest_static true [prev_facts] facts)); |
28100
7650d5e0f8fb
refined theorem dependency output: previous state needs to contain a theory (not empty toplevel);
wenzelm
parents:
28096
diff
changeset
|
395 |
in |
21968 | 396 |
if null names orelse null deps then () |
397 |
else thm_deps_message (spaces_quote names, spaces_quote deps) |
|
398 |
end |
|
28096
046418f64474
theorem dependency output: Toplevel.add_hook, ProofGeneralPgip.new_thms_deps;
wenzelm
parents:
28020
diff
changeset
|
399 |
else ()); |
21642 | 400 |
|
401 |
end; |
|
402 |
||
403 |
||
52007
0b1183012a3c
maintain ProofGeneral preferences within ProofGeneral module;
wenzelm
parents:
52006
diff
changeset
|
404 |
|
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
405 |
(** startup **) |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
406 |
|
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
407 |
(* init *) |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
408 |
|
52013 | 409 |
val proof_generalN = "ProofGeneral"; |
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
410 |
|
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
411 |
val initialized = Unsynchronized.ref false; |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
412 |
|
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
413 |
fun init () = |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
414 |
(if ! initialized then () |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
415 |
else |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
416 |
(Output.add_mode Symbol.xsymbolsN Symbol.output Output.default_escape; |
52013 | 417 |
Output.add_mode proof_generalN Output.default_output Output.default_escape; |
418 |
Markup.add_mode proof_generalN YXML.output_markup; |
|
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
419 |
setup_messages (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
420 |
setup_thy_loader (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
421 |
setup_present_hook (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
422 |
initialized := true); |
52017
bc0238c1f73a
clarified preferences: "override" re-initialized on prover startup, and "default" sent to PG -- thus recover typical defaults like auto-quickcheck in PG 4.x;
wenzelm
parents:
52016
diff
changeset
|
423 |
init_preferences (); |
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
424 |
sync_thy_loader (); |
52013 | 425 |
Unsynchronized.change print_mode (update (op =) proof_generalN); |
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
426 |
Secure.PG_setup (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
427 |
Isar.toplevel_loop TextIO.stdIn |
52015
d021c180e7df
back to hidden welcome -- revert change 9ebf2da69b29, which appears to disturb startup protocol of PG 4.1;
wenzelm
parents:
52014
diff
changeset
|
428 |
{init = true, welcome = true, sync = true, secure = Secure.is_secure ()}); |
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
429 |
|
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
430 |
|
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
431 |
(* restart *) |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
432 |
|
52015
d021c180e7df
back to hidden welcome -- revert change 9ebf2da69b29, which appears to disturb startup protocol of PG 4.1;
wenzelm
parents:
52014
diff
changeset
|
433 |
val welcome = Output.urgent_message o Session.welcome; |
d021c180e7df
back to hidden welcome -- revert change 9ebf2da69b29, which appears to disturb startup protocol of PG 4.1;
wenzelm
parents:
52014
diff
changeset
|
434 |
|
52012
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
435 |
fun restart () = |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
436 |
(sync_thy_loader (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
437 |
tell_clear_goals (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
438 |
tell_clear_response (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
439 |
Isar.init (); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
440 |
welcome ()); |
9ebf2da69b29
uniform welcome -- actually visible on startup via Output.urgent_message;
wenzelm
parents:
52011
diff
changeset
|
441 |
|
21642 | 442 |
end; |
37977
3ceccd415145
simplified/clarified theory loader: more explicit task management, kill old versions at start, commit results only in the very end, non-optional master dependency, do not store text in deps;
wenzelm
parents:
37954
diff
changeset
|
443 |