author | haftmann |
Thu, 16 Sep 2010 17:52:00 +0200 | |
changeset 39481 | f15514acc942 |
parent 38831 | 4933a3dfd745 |
child 39440 | 4c2547af5909 |
permissions | -rw-r--r-- |
28405 | 1 |
(* Title: Pure/context_position.ML |
2 |
Author: Makarius |
|
3 |
||
28409 | 4 |
Context position visibility flag. |
28405 | 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 |
|
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 |
38481
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents:
38237
diff
changeset
|
13 |
val report_text: Proof.context -> Markup.T -> Position.T -> string -> unit |
38237
8b0383334031
prefer Context_Position.report where a proper context is available -- notably for "inner" entities;
wenzelm
parents:
33519
diff
changeset
|
14 |
val report: Proof.context -> Markup.T -> Position.T -> unit |
28405 | 15 |
end; |
16 |
||
33383 | 17 |
structure Context_Position: CONTEXT_POSITION = |
28405 | 18 |
struct |
19 |
||
33519 | 20 |
structure Data = Proof_Data |
28405 | 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 |
||
38831
4933a3dfd745
more careful treatment of context visibility flag wrt. spurious warnings;
wenzelm
parents:
38481
diff
changeset
|
30 |
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
|
31 |
|
38481
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents:
38237
diff
changeset
|
32 |
fun report_text ctxt markup pos txt = |
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents:
38237
diff
changeset
|
33 |
if is_visible ctxt then Position.report_text markup pos txt else (); |
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents:
38237
diff
changeset
|
34 |
|
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
wenzelm
parents:
38237
diff
changeset
|
35 |
fun report ctxt markup pos = report_text ctxt markup pos ""; |
28405 | 36 |
|
37 |
end; |