src/Pure/context_position.ML
author wenzelm
Sat May 15 23:23:45 2010 +0200 (2010-05-15)
changeset 36951 985c197f2fe9
parent 33519 e31a85f92ce9
child 38237 8b0383334031
permissions -rw-r--r--
renamed structure ValueParse to Parse_Value;
eliminated old-style structure alias V;
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@33383
    15
structure Context_Position: CONTEXT_POSITION =
wenzelm@28405
    16
struct
wenzelm@28405
    17
wenzelm@33519
    18
structure Data = Proof_Data
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;