Context position visibility.
authorwenzelm
Mon, 29 Sep 2008 14:41:23 +0200
changeset 28405 000dee6d5d80
parent 28404 b906dd1de855
child 28406 daeb21fec18f
Context position visibility.
src/Pure/context_position.ML
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/context_position.ML	Mon Sep 29 14:41:23 2008 +0200
@@ -0,0 +1,32 @@
+(*  Title:      Pure/context_position.ML
+    ID:         $Id$
+    Author:     Makarius
+
+Context position visibility.
+*)
+
+signature CONTEXT_POSITION =
+sig
+  val is_visible: Proof.context -> bool
+  val set_visible: bool -> Proof.context -> Proof.context
+  val restore_visible: Proof.context -> Proof.context -> Proof.context
+  val report: Proof.context -> Markup.T -> Position.T -> unit
+end;
+
+structure ContextPosition: CONTEXT_POSITION =
+struct
+
+structure Data = ProofDataFun
+(
+  type T = bool;
+  fun init _ = true;
+);
+
+val is_visible = Data.get;
+val set_visible = Data.put;
+val restore_visible = set_visible o is_visible;
+
+fun report ctxt markup pos =
+  if is_visible ctxt then Position.report markup pos else ();
+
+end;