src/Pure/context_position.ML
author blanchet
Thu, 16 Dec 2010 22:45:02 +0100
changeset 41220 4d11b0de7dd8
parent 39508 dfacdb01e1ec
child 41470 890b25753bf7
permissions -rw-r--r--
discriminate SMT errors a bit better
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/context_position.ML
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     3
28409
a1feb819b0a2 renamed report to report_visible;
wenzelm
parents: 28405
diff changeset
     4
Context position visibility flag.
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     5
*)
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     6
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     7
signature CONTEXT_POSITION =
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     8
sig
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
     9
  val is_visible: Proof.context -> bool
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    10
  val set_visible: bool -> Proof.context -> Proof.context
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    11
  val restore_visible: Proof.context -> Proof.context -> Proof.context
38831
4933a3dfd745 more careful treatment of context visibility flag wrt. spurious warnings;
wenzelm
parents: 38481
diff changeset
    12
  val if_visible: Proof.context -> ('a -> unit) -> 'a -> unit
39507
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    13
  val reported_text: Proof.context -> Position.T -> Markup.T -> string -> string
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    14
  val report_text: Proof.context -> Position.T -> Markup.T -> string -> unit
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    15
  val report: Proof.context -> Position.T -> Markup.T -> unit
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    16
end;
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    17
33383
12d79ece3f7e modernized structure Context_Position;
wenzelm
parents: 29606
diff changeset
    18
structure Context_Position: CONTEXT_POSITION =
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    19
struct
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    20
39508
dfacdb01e1ec simplified some internal flags using Config.T instead of full-blown Proof_Data;
wenzelm
parents: 39507
diff changeset
    21
val visible = Config.bool (Config.declare "Context_Position.visible" (K (Config.Bool true)));
dfacdb01e1ec simplified some internal flags using Config.T instead of full-blown Proof_Data;
wenzelm
parents: 39507
diff changeset
    22
fun is_visible ctxt = Config.get ctxt visible;
dfacdb01e1ec simplified some internal flags using Config.T instead of full-blown Proof_Data;
wenzelm
parents: 39507
diff changeset
    23
val set_visible = Config.put visible;
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    24
val restore_visible = set_visible o is_visible;
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    25
38831
4933a3dfd745 more careful treatment of context visibility flag wrt. spurious warnings;
wenzelm
parents: 38481
diff changeset
    26
fun if_visible ctxt f x = if is_visible ctxt then f x else ();
4933a3dfd745 more careful treatment of context visibility flag wrt. spurious warnings;
wenzelm
parents: 38481
diff changeset
    27
39507
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    28
fun reported_text ctxt pos markup txt =
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    29
  if is_visible ctxt then Position.reported_text pos markup txt else "";
38481
81ec258c4cd3 Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents: 38237
diff changeset
    30
39507
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    31
fun report_text ctxt pos markup txt = Output.report (reported_text ctxt pos markup txt);
839873937ddd tuned signature of (Context_)Position.report variants;
wenzelm
parents: 39440
diff changeset
    32
fun report ctxt pos markup = report_text ctxt pos markup "";
28405
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    33
000dee6d5d80 Context position visibility.
wenzelm
parents:
diff changeset
    34
end;