moved global state to structure Document (again);
authorwenzelm
Fri, 08 Jul 2011 22:00:53 +0200
changeset 43713 1ba5331b4623
parent 43712 3c2c912af2ef
child 43714 3749d1e6dde9
child 43732 6b2bdc57155b
moved global state to structure Document (again);
src/Pure/PIDE/document.ML
src/Pure/PIDE/isar_document.ML
--- a/src/Pure/PIDE/document.ML	Fri Jul 08 21:44:47 2011 +0200
+++ b/src/Pure/PIDE/document.ML	Fri Jul 08 22:00:53 2011 +0200
@@ -23,6 +23,8 @@
   val define_command: command_id -> string -> state -> state
   val edit: version_id -> version_id -> edit list -> state -> (command_id * exec_id) list * state
   val execute: version_id -> state -> state
+  val state: unit -> state
+  val change_state: (state -> state) -> unit
 end;
 
 structure Document: DOCUMENT =
@@ -359,5 +361,14 @@
 
     in (versions, commands, execs, execution') end);
 
+
+
+(** global state **)
+
+val global_state = Synchronized.var "Document" init_state;
+
+fun state () = Synchronized.value global_state;
+val change_state = Synchronized.change global_state;
+
 end;
 
--- a/src/Pure/PIDE/isar_document.ML	Fri Jul 08 21:44:47 2011 +0200
+++ b/src/Pure/PIDE/isar_document.ML	Fri Jul 08 22:00:53 2011 +0200
@@ -4,26 +4,16 @@
 Protocol message formats for interactive Isar documents.
 *)
 
-signature ISAR_DOCUMENT =
-sig
-  val state: unit -> Document.state
-end
-
-structure Isar_Document: ISAR_DOCUMENT =
+structure Isar_Document: sig end =
 struct
 
-val global_state = Synchronized.var "Isar_Document" Document.init_state;
-val change_state = Synchronized.change global_state;
-
-fun state () = Synchronized.value global_state;
-
 val _ =
   Isabelle_Process.add_command "Isar_Document.define_command"
-    (fn [id, text] => change_state (Document.define_command (Document.parse_id id) text));
+    (fn [id, text] => Document.change_state (Document.define_command (Document.parse_id id) text));
 
 val _ =
   Isabelle_Process.add_command "Isar_Document.edit_version"
-    (fn [old_id_string, new_id_string, edits_yxml] => change_state (fn state =>
+    (fn [old_id_string, new_id_string, edits_yxml] => Document.change_state (fn state =>
       let
         val old_id = Document.parse_id old_id_string;
         val new_id = Document.parse_id new_id_string;