38 val names: unit -> string list |
38 val names: unit -> string list |
39 val get_theory: string -> theory |
39 val get_theory: string -> theory |
40 val put_theory: theory -> unit |
40 val put_theory: theory -> unit |
41 val loaded_files: string -> (Path.T * File.info) list |
41 val loaded_files: string -> (Path.T * File.info) list |
42 val load_file: bool -> Path.T -> unit |
42 val load_file: bool -> Path.T -> unit |
|
43 val use_path: Path.T -> unit |
43 val use: string -> unit |
44 val use: string -> unit |
44 val use_thy_only: string -> unit |
45 val use_thy_only: string -> unit |
45 val begin_theory: string -> string list -> theory |
46 val begin_theory: string -> string list -> (Path.T * bool) list -> theory |
46 val end_theory: theory -> theory |
47 val end_theory: theory -> theory |
47 val finalize_all: unit -> unit |
48 val finalize_all: unit -> unit |
48 val register_theory: theory -> unit |
49 val register_theory: theory -> unit |
49 end; |
50 end; |
50 |
51 |
246 (writeln ("\n**** Starting file " ^ quote name ^ " ****"); |
247 (writeln ("\n**** Starting file " ^ quote name ^ " ****"); |
247 run_file path; |
248 run_file path; |
248 writeln ("**** Finished file " ^ quote name ^ " ****\n"))) |
249 writeln ("**** Finished file " ^ quote name ^ " ****\n"))) |
249 end; |
250 end; |
250 |
251 |
251 val use = load_file false o Path.unpack; |
252 val use_path = load_file false; |
|
253 val use = use_path o Path.unpack; |
252 val time_use = load_file true o Path.unpack; |
254 val time_use = load_file true o Path.unpack; |
253 |
255 |
254 |
256 |
255 (* require_thy *) |
257 (* require_thy *) |
256 |
258 |
304 val update_thy = gen_use_thy (require_thy true false true true []); |
306 val update_thy = gen_use_thy (require_thy true false true true []); |
305 val time_use_thy = gen_use_thy (require_thy true true true false []); |
307 val time_use_thy = gen_use_thy (require_thy true true true false []); |
306 val use_thy_only = gen_use_thy (require_thy false false true false []); |
308 val use_thy_only = gen_use_thy (require_thy false false true false []); |
307 |
309 |
308 |
310 |
309 (* begin / end theory *) (* FIXME tune *) |
311 (* begin / end theory *) (* FIXME tune *) (* FIXME files vs. paths (!?!?) *) |
310 |
312 |
311 fun begin_theory name parents = |
313 fun begin_theory name parents paths = |
312 let |
314 let |
313 val _ = seq weak_use_thy parents; |
315 val _ = seq weak_use_thy parents; |
314 val theory = PureThy.begin_theory name (map get_theory parents); |
316 val theory = PureThy.begin_theory name (map get_theory parents); |
315 val _ = change_thys (update_node name parents (init_deps [] [], Some (theory, Symtab.empty))); |
317 val _ = change_thys (update_node name parents (init_deps [] [], Some (theory, Symtab.empty))); |
316 in theory end; |
318 val use_paths = mapfilter (fn (x, true) => Some x | _ => None) paths; |
|
319 in Context.setmp (Some theory) (seq use_path) use_paths; theory end; |
317 |
320 |
318 fun end_theory theory = |
321 fun end_theory theory = |
319 let val theory' = PureThy.end_theory theory |
322 let val theory' = PureThy.end_theory theory |
320 in put_theory theory'; theory' end; |
323 in put_theory theory'; theory' end; |
321 |
324 |