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