| author | aspinall |
| Mon, 22 Jan 2007 15:34:15 +0100 | |
| changeset 22159 | 0cf0d3912239 |
| parent 22040 | 635aaa46b44d |
| child 22161 | b2117f4f2d39 |
| permissions | -rw-r--r-- |
| 21637 | 1 |
(* Title: Pure/ProofGeneral/pgip_output.ML |
2 |
ID: $Id$ |
|
3 |
Author: David Aspinall |
|
4 |
||
| 21940 | 5 |
PGIP abstraction: output commands. |
| 21637 | 6 |
*) |
7 |
||
8 |
signature PGIPOUTPUT = |
|
9 |
sig |
|
10 |
(* These are the PGIP messages which the prover emits. *) |
|
11 |
datatype pgipoutput = |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
12 |
Cleardisplay of { area: PgipTypes.displayarea }
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
13 |
| Normalresponse of { area: PgipTypes.displayarea,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
14 |
urgent: bool, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
15 |
messagecategory: PgipTypes.messagecategory, |
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
16 |
content: XML.content } |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
17 |
| Errorresponse of { fatality: PgipTypes.fatality,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
18 |
area: PgipTypes.displayarea option, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
19 |
location: PgipTypes.location option, |
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
20 |
content: XML.content } |
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
21 |
| Informfileloaded of { url: PgipTypes.pgipurl, completed: bool }
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
22 |
| Informfileoutdated of { url: PgipTypes.pgipurl, completed: bool }
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
23 |
| Informfileretracted of { url: PgipTypes.pgipurl, completed: bool }
|
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
24 |
| Proofstate of { pgml: XML.content }
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
25 |
| Metainforesponse of { attrs: XML.attributes,
|
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
26 |
content: XML.content } |
|
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
27 |
| Lexicalstructure of { content: XML.content }
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
28 |
| Proverinfo of { name: string,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
29 |
version: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
30 |
instance: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
31 |
descr: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
32 |
url: Url.T, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
33 |
filenameextns: string } |
| 21867 | 34 |
| Setids of { idtables: PgipTypes.idtable list }
|
35 |
| Delids of { idtables: PgipTypes.idtable list }
|
|
36 |
| Addids of { idtables: PgipTypes.idtable list }
|
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
37 |
| Hasprefs of { prefcategory: string option,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
38 |
prefs: PgipTypes.preference list } |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
39 |
| Prefval of { name: string, value: string }
|
| 21867 | 40 |
| Idvalue of { name: PgipTypes.objname,
|
41 |
objtype: PgipTypes.objtype, |
|
42 |
text: XML.content } |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
43 |
| Informguise of { file : PgipTypes.pgipurl option,
|
| 21867 | 44 |
theory: PgipTypes.objname option, |
45 |
theorem: PgipTypes.objname option, |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
46 |
proofpos: int option } |
| 21867 | 47 |
| Parseresult of { attrs: XML.attributes, doc:PgipMarkup.pgipdocument,
|
48 |
errs: XML.content } (* errs to become PGML *) |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
49 |
| Usespgip of { version: string,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
50 |
pgipelems: (string * bool * string list) list } |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
51 |
| Usespgml of { version: string }
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
52 |
| Pgip of { tag: string option,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
53 |
class: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
54 |
seq: int, id: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
55 |
destid: string option, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
56 |
refid: string option, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
57 |
refseq: int option, |
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
58 |
content: XML.content } |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
59 |
| Ready of { }
|
| 21637 | 60 |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
61 |
val output : pgipoutput -> XML.tree |
| 21637 | 62 |
end |
63 |
||
64 |
structure PgipOutput : PGIPOUTPUT = |
|
65 |
struct |
|
66 |
open PgipTypes |
|
67 |
||
68 |
datatype pgipoutput = |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
69 |
Cleardisplay of { area: displayarea }
|
| 21637 | 70 |
| Normalresponse of { area: displayarea, urgent: bool,
|
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
71 |
messagecategory: messagecategory, content: XML.content } |
| 21637 | 72 |
| Errorresponse of { area: displayarea option, fatality: fatality,
|
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
73 |
location: location option, content: XML.content } |
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
74 |
| Informfileloaded of { url: Path.T, completed: bool }
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
75 |
| Informfileoutdated of { url: Path.T, completed: bool }
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
76 |
| Informfileretracted of { url: Path.T, completed: bool }
|
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
77 |
| Proofstate of { pgml: XML.content }
|
|
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
78 |
| Metainforesponse of { attrs: XML.attributes, content: XML.content }
|
|
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
79 |
| Lexicalstructure of { content: XML.content }
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
80 |
| Proverinfo of { name: string, version: string, instance: string,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
81 |
descr: string, url: Url.T, filenameextns: string } |
| 21867 | 82 |
| Setids of { idtables: PgipTypes.idtable list }
|
83 |
| Delids of { idtables: PgipTypes.idtable list }
|
|
84 |
| Addids of { idtables: PgipTypes.idtable list }
|
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
85 |
| Hasprefs of { prefcategory: string option, prefs: preference list }
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
86 |
| Prefval of { name: string, value: string }
|
| 21867 | 87 |
| Idvalue of { name: PgipTypes.objname,
|
88 |
objtype: PgipTypes.objtype, |
|
89 |
text: XML.content } |
|
90 |
| Informguise of { file : PgipTypes.pgipurl option,
|
|
91 |
theory: PgipTypes.objname option, |
|
92 |
theorem: PgipTypes.objname option, |
|
93 |
proofpos: int option } |
|
94 |
| Parseresult of { attrs: XML.attributes, doc: PgipMarkup.pgipdocument,
|
|
95 |
errs: XML.content } (* errs to become PGML *) |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
96 |
| Usespgip of { version: string,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
97 |
pgipelems: (string * bool * string list) list } |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
98 |
| Usespgml of { version: string }
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
99 |
| Pgip of { tag: string option,
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
100 |
class: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
101 |
seq: int, id: string, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
102 |
destid: string option, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
103 |
refid: string option, |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
104 |
refseq: int option, |
|
21655
01b2d13153c8
Document structure in pgip_markup.ML. Minor fixes.
aspinall
parents:
21651
diff
changeset
|
105 |
content: XML.content } |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
106 |
| Ready of { }
|
| 21637 | 107 |
|
108 |
||
109 |
(* Construct output XML messages *) |
|
| 21902 | 110 |
|
111 |
fun cleardisplay (Cleardisplay vs) = |
|
| 21637 | 112 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
113 |
val area = #area vs |
| 21637 | 114 |
in |
| 21940 | 115 |
XML.Elem ("cleardisplay", attrs_of_displayarea area, [])
|
| 21637 | 116 |
end |
117 |
||
| 21902 | 118 |
fun normalresponse (Normalresponse vs) = |
| 21637 | 119 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
120 |
val area = #area vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
121 |
val urgent = #urgent vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
122 |
val messagecategory = #messagecategory vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
123 |
val content = #content vs |
| 21637 | 124 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
125 |
XML.Elem ("normalresponse",
|
| 21940 | 126 |
attrs_of_displayarea area @ |
| 21651 | 127 |
(if urgent then attr "urgent" "true" else []) @ |
| 21940 | 128 |
attrs_of_messagecategory messagecategory, |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
129 |
content) |
| 21637 | 130 |
end |
| 21902 | 131 |
|
132 |
fun errorresponse (Errorresponse vs) = |
|
| 21637 | 133 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
134 |
val area = #area vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
135 |
val fatality = #fatality vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
136 |
val location = #location vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
137 |
val content = #content vs |
| 21637 | 138 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
139 |
XML.Elem ("errorresponse",
|
| 21940 | 140 |
these (Option.map attrs_of_displayarea area) @ |
141 |
attrs_of_fatality fatality @ |
|
142 |
these (Option.map attrs_of_location location), |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
143 |
content) |
| 21637 | 144 |
end |
145 |
||
| 21902 | 146 |
fun informfileloaded (Informfileloaded vs) = |
| 21637 | 147 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
148 |
val url = #url vs |
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
149 |
val completed = #completed vs |
| 21637 | 150 |
in |
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
151 |
XML.Elem ("informfileloaded",
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
152 |
attrs_of_pgipurl url @ |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
153 |
(attr "completed" (PgipTypes.bool_to_pgstring completed)), |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
154 |
[]) |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
155 |
end |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
156 |
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
157 |
fun informfileoutdated (Informfileoutdated vs) = |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
158 |
let |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
159 |
val url = #url vs |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
160 |
val completed = #completed vs |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
161 |
in |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
162 |
XML.Elem ("informfileoutdated",
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
163 |
attrs_of_pgipurl url @ |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
164 |
(attr "completed" (PgipTypes.bool_to_pgstring completed)), |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
165 |
[]) |
| 21637 | 166 |
end |
167 |
||
| 21902 | 168 |
fun informfileretracted (Informfileretracted vs) = |
169 |
let |
|
170 |
val url = #url vs |
|
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
171 |
val completed = #completed vs |
| 21902 | 172 |
in |
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
173 |
XML.Elem ("informfileretracted",
|
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
174 |
attrs_of_pgipurl url @ |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
175 |
(attr "completed" (PgipTypes.bool_to_pgstring completed)), |
|
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
176 |
[]) |
| 21902 | 177 |
end |
| 21637 | 178 |
|
| 21902 | 179 |
fun proofstate (Proofstate vs) = |
| 21637 | 180 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
181 |
val pgml = #pgml vs |
| 21637 | 182 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
183 |
XML.Elem("proofstate", [], pgml)
|
| 21637 | 184 |
end |
185 |
||
| 21902 | 186 |
fun metainforesponse (Metainforesponse vs) = |
| 21637 | 187 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
188 |
val attrs = #attrs vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
189 |
val content = #content vs |
| 21637 | 190 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
191 |
XML.Elem ("metainforesponse", attrs, content)
|
| 21637 | 192 |
end |
193 |
||
| 21902 | 194 |
fun lexicalstructure (Lexicalstructure vs) = |
| 21637 | 195 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
196 |
val content = #content vs |
| 21637 | 197 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
198 |
XML.Elem ("lexicalstructure", [], content)
|
| 21637 | 199 |
end |
200 |
||
| 21902 | 201 |
fun proverinfo (Proverinfo vs) = |
| 21637 | 202 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
203 |
val name = #name vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
204 |
val version = #version vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
205 |
val instance = #instance vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
206 |
val descr = #descr vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
207 |
val url = #url vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
208 |
val filenameextns = #filenameextns vs |
| 21637 | 209 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
210 |
XML.Elem ("proverinfo",
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
211 |
[("name", name),
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
212 |
("version", version),
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
213 |
("instance", instance),
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
214 |
("descr", descr),
|
|
21858
05f57309170c
avoid conflict with Alice keywords: renamed pack -> implode, unpack -> explode, any -> many, avoided assert;
wenzelm
parents:
21655
diff
changeset
|
215 |
("url", Url.implode url),
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
216 |
("filenameextns", filenameextns)],
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
217 |
[]) |
| 21637 | 218 |
end |
219 |
||
| 21902 | 220 |
fun setids (Setids vs) = |
| 21637 | 221 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
222 |
val idtables = #idtables vs |
| 21637 | 223 |
in |
| 21867 | 224 |
XML.Elem ("setids",[],map idtable_to_xml idtables)
|
| 21637 | 225 |
end |
226 |
||
| 21902 | 227 |
fun addids (Addids vs) = |
| 21637 | 228 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
229 |
val idtables = #idtables vs |
| 21637 | 230 |
in |
| 21867 | 231 |
XML.Elem ("addids",[],map idtable_to_xml idtables)
|
| 21637 | 232 |
end |
233 |
||
| 21902 | 234 |
fun delids (Delids vs) = |
| 21637 | 235 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
236 |
val idtables = #idtables vs |
| 21637 | 237 |
in |
| 21867 | 238 |
XML.Elem ("delids",[],map idtable_to_xml idtables)
|
| 21637 | 239 |
end |
240 |
||
| 21902 | 241 |
fun hasprefs (Hasprefs vs) = |
| 21637 | 242 |
let |
243 |
val prefcategory = #prefcategory vs |
|
244 |
val prefs = #prefs vs |
|
245 |
in |
|
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
246 |
XML.Elem("hasprefs",opt_attr "prefcategory" prefcategory, map haspref prefs)
|
| 21637 | 247 |
end |
248 |
||
| 21902 | 249 |
fun prefval (Prefval vs) = |
| 21637 | 250 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
251 |
val name = #name vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
252 |
val value = #value vs |
| 21637 | 253 |
in |
| 21651 | 254 |
XML.Elem("prefval", attr "name" name, [XML.Text value])
|
| 21637 | 255 |
end |
256 |
||
| 21902 | 257 |
fun idvalue (Idvalue vs) = |
| 21637 | 258 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
259 |
val name = #name vs |
| 21867 | 260 |
val objtype_attrs = attrs_of_objtype (#objtype vs) |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
261 |
val text = #text vs |
| 21637 | 262 |
in |
| 21867 | 263 |
XML.Elem("idvalue", attr "name" name @ objtype_attrs, text)
|
| 21902 | 264 |
end |
| 21637 | 265 |
|
| 21902 | 266 |
fun informguise (Informguise vs) = |
| 21637 | 267 |
let |
268 |
val file = #file vs |
|
269 |
val theory = #theory vs |
|
270 |
val theorem = #theorem vs |
|
271 |
val proofpos = #proofpos vs |
|
272 |
||
273 |
fun elto nm attrfn xo = case xo of NONE=>[] | SOME x=>[XML.Elem(nm,attrfn x,[])] |
|
274 |
||
275 |
val guisefile = elto "guisefile" attrs_of_pgipurl file |
|
276 |
val guisetheory = elto "guisetheory" (single o (pair "thyname")) theory |
|
277 |
val guiseproof = elto "guiseproof" |
|
| 21651 | 278 |
(fn thm=>(attr "thmname" thm) @ |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
279 |
(opt_attr "proofpos" (Option.map Int.toString proofpos))) theorem |
| 21637 | 280 |
in |
281 |
XML.Elem("informguise", [], guisefile @ guisetheory @ guiseproof)
|
|
282 |
end |
|
283 |
||
| 21902 | 284 |
fun parseresult (Parseresult vs) = |
| 21637 | 285 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
286 |
val attrs = #attrs vs |
| 21867 | 287 |
val doc = #doc vs |
288 |
val errs = #errs vs |
|
289 |
val xmldoc = PgipMarkup.output_doc doc |
|
| 21637 | 290 |
in |
| 21940 | 291 |
XML.Elem("parseresult", attrs, errs @ xmldoc)
|
| 21637 | 292 |
end |
293 |
||
| 21902 | 294 |
fun acceptedpgipelems (Usespgip vs) = |
295 |
let |
|
296 |
val pgipelems = #pgipelems vs |
|
297 |
fun async_attrs b = if b then attr "async" "true" else [] |
|
298 |
fun attrs_attrs attrs = if attrs=[] then [] else attr "attributes" (space_implode "," attrs) |
|
299 |
fun singlepgipelem (e,async,attrs) = |
|
300 |
XML.Elem("pgipelem", ((async_attrs async) @ (attrs_attrs attrs)),[XML.Text e])
|
|
301 |
||
302 |
in |
|
303 |
XML.Elem ("acceptedpgipelems", [],
|
|
304 |
map singlepgipelem pgipelems) |
|
305 |
end |
|
306 |
||
307 |
fun usespgip (Usespgip vs) = |
|
| 21637 | 308 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
309 |
val version = #version vs |
| 21902 | 310 |
val acceptedelems = acceptedpgipelems (Usespgip vs) |
| 21637 | 311 |
in |
| 21651 | 312 |
XML.Elem("usespgip", attr "version" version, [acceptedelems])
|
| 21637 | 313 |
end |
314 |
||
| 21902 | 315 |
fun usespgml (Usespgml vs) = |
| 21637 | 316 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
317 |
val version = #version vs |
| 21637 | 318 |
in |
| 21651 | 319 |
XML.Elem("usespgml", attr "version" version, [])
|
| 21637 | 320 |
end |
321 |
||
| 21902 | 322 |
fun pgip (Pgip vs) = |
| 21637 | 323 |
let |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
324 |
val tag = #tag vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
325 |
val class = #class vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
326 |
val seq = #seq vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
327 |
val id = #id vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
328 |
val destid = #destid vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
329 |
val refid = #refid vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
330 |
val refseq = #refseq vs |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
331 |
val content = #content vs |
| 21637 | 332 |
in |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
333 |
XML.Elem("pgip",
|
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
334 |
opt_attr "tag" tag @ |
| 21651 | 335 |
attr "id" id @ |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
336 |
opt_attr "destid" destid @ |
| 21651 | 337 |
attr "class" class @ |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
338 |
opt_attr "refid" refid @ |
|
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
339 |
opt_attr_map string_of_int "refseq" refseq @ |
| 21651 | 340 |
attr "seq" (string_of_int seq), |
|
21649
40e6fdd26f82
Support PGIP communication for preferences in Emacs mode.
aspinall
parents:
21637
diff
changeset
|
341 |
content) |
| 21637 | 342 |
end |
343 |
||
| 21902 | 344 |
fun ready (Ready vs) = XML.Elem("ready",[],[])
|
| 21637 | 345 |
|
346 |
||
347 |
fun output pgipoutput = case pgipoutput of |
|
| 21929 | 348 |
Cleardisplay _ => cleardisplay pgipoutput |
| 21902 | 349 |
| Normalresponse _ => normalresponse pgipoutput |
350 |
| Errorresponse _ => errorresponse pgipoutput |
|
351 |
| Informfileloaded _ => informfileloaded pgipoutput |
|
|
22040
635aaa46b44d
Add informfileoutdated and completed flag. This makes the PGIP messages match the Broker states.
aspinall
parents:
21940
diff
changeset
|
352 |
| Informfileoutdated _ => informfileoutdated pgipoutput |
| 21902 | 353 |
| Informfileretracted _ => informfileretracted pgipoutput |
354 |
| Proofstate _ => proofstate pgipoutput |
|
355 |
| Metainforesponse _ => metainforesponse pgipoutput |
|
356 |
| Lexicalstructure _ => lexicalstructure pgipoutput |
|
357 |
| Proverinfo _ => proverinfo pgipoutput |
|
358 |
| Setids _ => setids pgipoutput |
|
359 |
| Addids _ => addids pgipoutput |
|
360 |
| Delids _ => delids pgipoutput |
|
361 |
| Hasprefs _ => hasprefs pgipoutput |
|
362 |
| Prefval _ => prefval pgipoutput |
|
363 |
| Idvalue _ => idvalue pgipoutput |
|
364 |
| Informguise _ => informguise pgipoutput |
|
365 |
| Parseresult _ => parseresult pgipoutput |
|
366 |
| Usespgip _ => usespgip pgipoutput |
|
367 |
| Usespgml _ => usespgml pgipoutput |
|
368 |
| Pgip _ => pgip pgipoutput |
|
369 |
| Ready _ => ready pgipoutput |
|
| 21637 | 370 |
|
371 |
end |
|
372 |