src/Pure/context_position.ML
author wenzelm
Thu Oct 01 23:27:05 2009 +0200 (2009-10-01)
changeset 32843 c8f5a7c8353f
parent 29606 fedb8be05f24
child 33383 12d79ece3f7e
permissions -rw-r--r--
moved cache_conv to src/Pure/conv.ML, use Thm.cterm_cache;
wenzelm@28405
     1
(*  Title:      Pure/context_position.ML
wenzelm@28405
     2
    Author:     Makarius
wenzelm@28405
     3
wenzelm@28409
     4
Context position visibility flag.
wenzelm@28405
     5
*)
wenzelm@28405
     6
wenzelm@28405
     7
signature CONTEXT_POSITION =
wenzelm@28405
     8
sig
wenzelm@28405
     9
  val is_visible: Proof.context -> bool
wenzelm@28405
    10
  val set_visible: bool -> Proof.context -> Proof.context
wenzelm@28405
    11
  val restore_visible: Proof.context -> Proof.context -> Proof.context
wenzelm@28409
    12
  val report_visible: Proof.context -> Markup.T -> Position.T -> unit
wenzelm@28405
    13
end;
wenzelm@28405
    14
wenzelm@28405
    15
structure ContextPosition: CONTEXT_POSITION =
wenzelm@28405
    16
struct
wenzelm@28405
    17
wenzelm@28405
    18
structure Data = ProofDataFun
wenzelm@28405
    19
(
wenzelm@28405
    20
  type T = bool;
wenzelm@28405
    21
  fun init _ = true;
wenzelm@28405
    22
);
wenzelm@28405
    23
wenzelm@28405
    24
val is_visible = Data.get;
wenzelm@28405
    25
val set_visible = Data.put;
wenzelm@28405
    26
val restore_visible = set_visible o is_visible;
wenzelm@28405
    27
wenzelm@28409
    28
fun report_visible ctxt markup pos =
wenzelm@28405
    29
  if is_visible ctxt then Position.report markup pos else ();
wenzelm@28405
    30
wenzelm@28405
    31
end;