src/Pure/context_position.ML
author wenzelm
Thu Sep 02 00:48:07 2010 +0200 (2010-09-02)
changeset 38980 af73cf0dc31f
parent 38831 4933a3dfd745
child 39440 4c2547af5909
permissions -rw-r--r--
turned show_question_marks into proper configuration option;
show_question_marks only affects regular type/term pretty printing, not raw Term.string_of_vname;
tuned;
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@38831
    12
  val if_visible: Proof.context -> ('a -> unit) -> 'a -> unit
wenzelm@38481
    13
  val report_text: Proof.context -> Markup.T -> Position.T -> string -> unit
wenzelm@38237
    14
  val report: Proof.context -> Markup.T -> Position.T -> unit
wenzelm@28405
    15
end;
wenzelm@28405
    16
wenzelm@33383
    17
structure Context_Position: CONTEXT_POSITION =
wenzelm@28405
    18
struct
wenzelm@28405
    19
wenzelm@33519
    20
structure Data = Proof_Data
wenzelm@28405
    21
(
wenzelm@28405
    22
  type T = bool;
wenzelm@28405
    23
  fun init _ = true;
wenzelm@28405
    24
);
wenzelm@28405
    25
wenzelm@28405
    26
val is_visible = Data.get;
wenzelm@28405
    27
val set_visible = Data.put;
wenzelm@28405
    28
val restore_visible = set_visible o is_visible;
wenzelm@28405
    29
wenzelm@38831
    30
fun if_visible ctxt f x = if is_visible ctxt then f x else ();
wenzelm@38831
    31
wenzelm@38481
    32
fun report_text ctxt markup pos txt =
wenzelm@38481
    33
  if is_visible ctxt then Position.report_text markup pos txt else ();
wenzelm@38481
    34
wenzelm@38481
    35
fun report ctxt markup pos = report_text ctxt markup pos "";
wenzelm@28405
    36
wenzelm@28405
    37
end;