src/Pure/PIDE/isabelle_document.ML
changeset 45709 87017fcbad83
parent 45708 7c8bed80301f
child 45717 b4e7b9968e60
     1.1 --- a/src/Pure/PIDE/isabelle_document.ML	Thu Dec 01 13:34:16 2011 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,84 +0,0 @@
     1.4 -(*  Title:      Pure/PIDE/isabelle_document.ML
     1.5 -    Author:     Makarius
     1.6 -
     1.7 -Protocol message formats for interactive Isar documents.
     1.8 -*)
     1.9 -
    1.10 -structure Isabelle_Document: sig end =
    1.11 -struct
    1.12 -
    1.13 -val _ =
    1.14 -  Isabelle_Process.add_command "Isabelle_Document.define_command"
    1.15 -    (fn [id, name, text] =>
    1.16 -      Document.change_state (Document.define_command (Document.parse_id id) name text));
    1.17 -
    1.18 -val _ =
    1.19 -  Isabelle_Process.add_command "Isabelle_Document.cancel_execution"
    1.20 -    (fn [] => ignore (Document.cancel_execution (Document.state ())));
    1.21 -
    1.22 -val _ =
    1.23 -  Isabelle_Process.add_command "Isabelle_Document.update_perspective"
    1.24 -    (fn [old_id_string, new_id_string, name, ids_yxml] => Document.change_state (fn state =>
    1.25 -      let
    1.26 -        val old_id = Document.parse_id old_id_string;
    1.27 -        val new_id = Document.parse_id new_id_string;
    1.28 -        val ids = YXML.parse_body ids_yxml
    1.29 -          |> let open XML.Decode in list int end;
    1.30 -
    1.31 -        val _ = Future.join_tasks (Document.cancel_execution state);
    1.32 -      in
    1.33 -        state
    1.34 -        |> Document.update_perspective old_id new_id name ids
    1.35 -        |> Document.execute new_id
    1.36 -      end));
    1.37 -
    1.38 -val _ =
    1.39 -  Isabelle_Process.add_command "Isabelle_Document.update"
    1.40 -    (fn [old_id_string, new_id_string, edits_yxml] => Document.change_state (fn state =>
    1.41 -      let
    1.42 -        val old_id = Document.parse_id old_id_string;
    1.43 -        val new_id = Document.parse_id new_id_string;
    1.44 -        val edits =
    1.45 -          YXML.parse_body edits_yxml |>
    1.46 -            let open XML.Decode in
    1.47 -              list (pair string
    1.48 -                (variant
    1.49 -                 [fn ([], []) => Document.Clear,
    1.50 -                  fn ([], a) => Document.Edits (list (pair (option int) (option int)) a),
    1.51 -                  fn ([], a) =>
    1.52 -                    Document.Header
    1.53 -                      (Exn.Res
    1.54 -                        (triple (pair string string) (list string) (list (pair string bool)) a)),
    1.55 -                  fn ([a], []) => Document.Header (Exn.Exn (ERROR a)),
    1.56 -                  fn (a, []) => Document.Perspective (map int_atom a)]))
    1.57 -            end;
    1.58 -
    1.59 -        val running = Document.cancel_execution state;
    1.60 -        val (assignment, state1) = Document.update old_id new_id edits state;
    1.61 -        val _ = Future.join_tasks running;
    1.62 -        val _ =
    1.63 -          Output.raw_message Isabelle_Markup.assign_execs
    1.64 -            ((new_id, assignment) |>
    1.65 -              let open XML.Encode
    1.66 -              in pair int (pair (list (pair int (option int))) (list (pair string (option int)))) end
    1.67 -              |> YXML.string_of_body);
    1.68 -        val state2 = Document.execute new_id state1;
    1.69 -      in state2 end));
    1.70 -
    1.71 -val _ =
    1.72 -  Isabelle_Process.add_command "Isabelle_Document.remove_versions"
    1.73 -    (fn [versions_yxml] => Document.change_state (fn state =>
    1.74 -      let
    1.75 -        val versions =
    1.76 -          YXML.parse_body versions_yxml |>
    1.77 -            let open XML.Decode in list int end;
    1.78 -        val state1 = Document.remove_versions versions state;
    1.79 -        val _ = Output.raw_message Isabelle_Markup.removed_versions versions_yxml;
    1.80 -      in state1 end));
    1.81 -
    1.82 -val _ =
    1.83 -  Isabelle_Process.add_command "Isabelle_Document.invoke_scala"
    1.84 -    (fn [id, tag, res] => Invoke_Scala.fulfill_method id tag res);
    1.85 -
    1.86 -end;
    1.87 -