src/Pure/context_position.ML
changeset 28405 000dee6d5d80
child 28409 a1feb819b0a2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Pure/context_position.ML	Mon Sep 29 14:41:23 2008 +0200
     1.3 @@ -0,0 +1,32 @@
     1.4 +(*  Title:      Pure/context_position.ML
     1.5 +    ID:         $Id$
     1.6 +    Author:     Makarius
     1.7 +
     1.8 +Context position visibility.
     1.9 +*)
    1.10 +
    1.11 +signature CONTEXT_POSITION =
    1.12 +sig
    1.13 +  val is_visible: Proof.context -> bool
    1.14 +  val set_visible: bool -> Proof.context -> Proof.context
    1.15 +  val restore_visible: Proof.context -> Proof.context -> Proof.context
    1.16 +  val report: Proof.context -> Markup.T -> Position.T -> unit
    1.17 +end;
    1.18 +
    1.19 +structure ContextPosition: CONTEXT_POSITION =
    1.20 +struct
    1.21 +
    1.22 +structure Data = ProofDataFun
    1.23 +(
    1.24 +  type T = bool;
    1.25 +  fun init _ = true;
    1.26 +);
    1.27 +
    1.28 +val is_visible = Data.get;
    1.29 +val set_visible = Data.put;
    1.30 +val restore_visible = set_visible o is_visible;
    1.31 +
    1.32 +fun report ctxt markup pos =
    1.33 +  if is_visible ctxt then Position.report markup pos else ();
    1.34 +
    1.35 +end;