src/Pure/Thy/export.ML
changeset 72103 7b318273a4aa
parent 71622 ab5009192ebb
child 72511 460d743010bc
equal deleted inserted replaced
72101:c65614b556b2 72103:7b318273a4aa
    14   val export_executable: theory -> Path.binding -> XML.body -> unit
    14   val export_executable: theory -> Path.binding -> XML.body -> unit
    15   val export_file: theory -> Path.binding -> Path.T -> unit
    15   val export_file: theory -> Path.binding -> Path.T -> unit
    16   val export_executable_file: theory -> Path.binding -> Path.T -> unit
    16   val export_executable_file: theory -> Path.binding -> Path.T -> unit
    17   val markup: theory -> Path.T -> Markup.T
    17   val markup: theory -> Path.T -> Markup.T
    18   val message: theory -> Path.T -> string
    18   val message: theory -> Path.T -> string
    19   val protocol_message: Output.protocol_message_fn
       
    20 end;
    19 end;
    21 
    20 
    22 structure Export: EXPORT =
    21 structure Export: EXPORT =
    23 struct
    22 struct
    24 
    23 
    69   in Active.make_markup Markup.theory_exportsN {implicit = false, properties = [name]} end;
    68   in Active.make_markup Markup.theory_exportsN {implicit = false, properties = [name]} end;
    70 
    69 
    71 fun message thy path =
    70 fun message thy path =
    72   "See " ^ Markup.markup (markup thy path) "theory exports";
    71   "See " ^ Markup.markup (markup thy path) "theory exports";
    73 
    72 
    74 
       
    75 (* protocol message (bootstrap) *)
       
    76 
       
    77 fun protocol_message props body =
       
    78   (case props of
       
    79     function :: args =>
       
    80       if function = (Markup.functionN, Markup.exportN) andalso
       
    81         not (null args) andalso #1 (hd args) = Markup.idN
       
    82       then
       
    83         let
       
    84           val path = Path.expand (Path.explode ("$ISABELLE_EXPORT_TMP/export" ^ serial_string ()));
       
    85           val _ = YXML.write_body path body;
       
    86         in Protocol_Message.marker (#2 function) (tl args @ [(Markup.fileN, Path.implode path)]) end
       
    87       else raise Output.Protocol_Message props
       
    88   | [] => raise Output.Protocol_Message props);
       
    89 
       
    90 val _ =
       
    91   if Thread_Data.is_virtual then ()
       
    92   else Private_Output.protocol_message_fn := protocol_message;
       
    93 
       
    94 end;
    73 end;