| author | wenzelm | 
| Mon, 13 Jun 2011 13:53:41 +0200 | |
| changeset 43374 | df1be524e60c | 
| parent 41470 | 890b25753bf7 | 
| child 44736 | c2a3f1c84179 | 
| 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: 
38481diff
changeset | 12 |   val if_visible: Proof.context -> ('a -> unit) -> 'a -> unit
 | 
| 41470 
890b25753bf7
added Context_Position.is_visible_proof, which treats a global theory as invisible (unlike the default);
 wenzelm parents: 
39508diff
changeset | 13 |   val if_visible_proof: Context.generic -> ('a -> unit) -> 'a -> unit
 | 
| 39507 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 14 | val reported_text: Proof.context -> Position.T -> Markup.T -> string -> string | 
| 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 15 | val report_text: Proof.context -> Position.T -> Markup.T -> string -> unit | 
| 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 16 | val report: Proof.context -> Position.T -> Markup.T -> unit | 
| 28405 | 17 | end; | 
| 18 | ||
| 33383 | 19 | structure Context_Position: CONTEXT_POSITION = | 
| 28405 | 20 | struct | 
| 21 | ||
| 39508 
dfacdb01e1ec
simplified some internal flags using Config.T instead of full-blown Proof_Data;
 wenzelm parents: 
39507diff
changeset | 22 | 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: 
39507diff
changeset | 23 | fun is_visible ctxt = Config.get ctxt visible; | 
| 
dfacdb01e1ec
simplified some internal flags using Config.T instead of full-blown Proof_Data;
 wenzelm parents: 
39507diff
changeset | 24 | val set_visible = Config.put visible; | 
| 28405 | 25 | val restore_visible = set_visible o is_visible; | 
| 26 | ||
| 38831 
4933a3dfd745
more careful treatment of context visibility flag wrt. spurious warnings;
 wenzelm parents: 
38481diff
changeset | 27 | 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: 
38481diff
changeset | 28 | |
| 41470 
890b25753bf7
added Context_Position.is_visible_proof, which treats a global theory as invisible (unlike the default);
 wenzelm parents: 
39508diff
changeset | 29 | fun if_visible_proof (Context.Proof ctxt) f x = if_visible ctxt f x | 
| 
890b25753bf7
added Context_Position.is_visible_proof, which treats a global theory as invisible (unlike the default);
 wenzelm parents: 
39508diff
changeset | 30 | | if_visible_proof _ _ _ = (); | 
| 
890b25753bf7
added Context_Position.is_visible_proof, which treats a global theory as invisible (unlike the default);
 wenzelm parents: 
39508diff
changeset | 31 | |
| 39507 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 32 | fun reported_text ctxt pos markup txt = | 
| 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 33 | if is_visible ctxt then Position.reported_text pos markup txt else ""; | 
| 38481 
81ec258c4cd3
Output_Position.report_text -- markup with potential "arguments";
 wenzelm parents: 
38237diff
changeset | 34 | |
| 39507 
839873937ddd
tuned signature of (Context_)Position.report variants;
 wenzelm parents: 
39440diff
changeset | 35 | 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: 
39440diff
changeset | 36 | fun report ctxt pos markup = report_text ctxt pos markup ""; | 
| 28405 | 37 | |
| 38 | end; |