equal
deleted
inserted
replaced
8 sig |
8 sig |
9 exception UNDEF |
9 exception UNDEF |
10 type state |
10 type state |
11 val init_toplevel: unit -> state |
11 val init_toplevel: unit -> state |
12 val theory_toplevel: theory -> state |
12 val theory_toplevel: theory -> state |
13 val get_prev_theory: generic_theory -> serial |
13 val get_prev_theory: theory -> serial |
14 val is_toplevel: state -> bool |
14 val is_toplevel: state -> bool |
15 val is_theory: state -> bool |
15 val is_theory: state -> bool |
16 val is_proof: state -> bool |
16 val is_proof: state -> bool |
17 val is_skipped_proof: state -> bool |
17 val is_skipped_proof: state -> bool |
18 val level: state -> int |
18 val level: state -> int |
146 |
146 |
147 fun init_toplevel () = State (node_presentation Toplevel, NONE); |
147 fun init_toplevel () = State (node_presentation Toplevel, NONE); |
148 fun theory_toplevel thy = State (node_presentation (Theory (Context.Theory thy)), NONE); |
148 fun theory_toplevel thy = State (node_presentation (Theory (Context.Theory thy)), NONE); |
149 |
149 |
150 val prev_theory = Config.declare_int ("prev_theory", Position.none) (K 0); |
150 val prev_theory = Config.declare_int ("prev_theory", Position.none) (K 0); |
151 fun get_prev_theory gthy = Config.get_global (Context.theory_of gthy) prev_theory; |
151 fun get_prev_theory thy = Config.get_global thy prev_theory; |
152 fun set_prev_theory (State (_, SOME prev_thy)) (Theory gthy) = |
152 fun set_prev_theory (State (_, SOME prev_thy)) (Theory gthy) = |
153 let |
153 let |
154 val put = Config.put_global prev_theory (Context.theory_identifier prev_thy); |
154 val put = Config.put_global prev_theory (Context.theory_identifier prev_thy); |
155 val gthy' = gthy |> Context.mapping put (Local_Theory.raw_theory put); |
155 val gthy' = gthy |> Context.mapping put (Local_Theory.raw_theory put); |
156 in Theory gthy' end |
156 in Theory gthy' end |