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;
     1 (*  Title:      Pure/context_position.ML
     2     Author:     Makarius
     3 
     4 Context position visibility flag.
     5 *)
     6 
     7 signature CONTEXT_POSITION =
     8 sig
     9   val is_visible: Proof.context -> bool
    10   val set_visible: bool -> Proof.context -> Proof.context
    11   val restore_visible: Proof.context -> Proof.context -> Proof.context
    12   val if_visible: Proof.context -> ('a -> unit) -> 'a -> unit
    13   val report_text: Proof.context -> Markup.T -> Position.T -> string -> unit
    14   val report: Proof.context -> Markup.T -> Position.T -> unit
    15 end;
    16 
    17 structure Context_Position: CONTEXT_POSITION =
    18 struct
    19 
    20 structure Data = Proof_Data
    21 (
    22   type T = bool;
    23   fun init _ = true;
    24 );
    25 
    26 val is_visible = Data.get;
    27 val set_visible = Data.put;
    28 val restore_visible = set_visible o is_visible;
    29 
    30 fun if_visible ctxt f x = if is_visible ctxt then f x else ();
    31 
    32 fun report_text ctxt markup pos txt =
    33   if is_visible ctxt then Position.report_text markup pos txt else ();
    34 
    35 fun report ctxt markup pos = report_text ctxt markup pos "";
    36 
    37 end;