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