148 | apply (f::fs) thy = apply fs (f thy) |
153 | apply (f::fs) thy = apply fs (f thy) |
149 in |
154 in |
150 apply (set_replaying_thy s::Theory.add_path s::(fst (importP token_list))) |
155 apply (set_replaying_thy s::Theory.add_path s::(fst (importP token_list))) |
151 end |
156 end |
152 |
157 |
|
158 fun create_int_thms thyname thy = |
|
159 case ImportData.get thy of |
|
160 None => ImportData.put (Some (fst (Replay.setup_int_thms thyname thy))) thy |
|
161 | Some _ => error "Import data not closed - forgotten an end_setup, mayhap?" |
|
162 |
|
163 fun clear_int_thms thy = |
|
164 case ImportData.get thy of |
|
165 None => error "Import data already cleared - forgotten a setup_theory?" |
|
166 | Some _ => ImportData.put None thy |
|
167 |
153 val setup_theory = P.name |
168 val setup_theory = P.name |
154 >> |
169 >> |
155 (fn thyname => |
170 (fn thyname => |
156 fn thy => |
171 fn thy => |
157 case HOL4DefThy.get thy of |
172 (case HOL4DefThy.get thy of |
158 NoImport => thy |> import_thy thyname |
173 NoImport => thy |
159 | Generating _ => error "Currently generating a theory!" |
174 | Generating _ => error "Currently generating a theory!" |
160 | Replaying _ => thy |> clear_import_thy |> import_thy thyname) |
175 | Replaying _ => thy |> clear_import_thy) |
|
176 |> import_thy thyname |
|
177 |> create_int_thms thyname) |
161 |
178 |
162 fun end_setup toks = |
179 fun end_setup toks = |
163 Scan.succeed |
180 Scan.succeed |
164 (fn thy => |
181 (fn thy => |
165 let |
182 let |
166 val thyname = get_import_thy thy |
183 val thyname = get_import_thy thy |
167 val segname = get_import_segment thy |
184 val segname = get_import_segment thy |
168 in |
185 in |
169 thy |> set_segment thyname segname |
186 thy |> set_segment thyname segname |
170 |> clear_import_thy |
187 |> clear_import_thy |
|
188 |> clear_int_thms |
171 |> Theory.parent_path |
189 |> Theory.parent_path |
172 end) toks |
190 end) toks |
173 |
191 |
174 val set_dump = P.string -- P.string >> setup_dump |
192 val set_dump = P.string -- P.string >> setup_dump |
175 fun fl_dump toks = Scan.succeed flush_dump toks |
193 fun fl_dump toks = Scan.succeed flush_dump toks |