equal
deleted
inserted
replaced
155 fun loaded_files name = |
155 fun loaded_files name = |
156 (case get_deps name of |
156 (case get_deps name of |
157 NONE => [] |
157 NONE => [] |
158 | SOME {master, files, ...} => |
158 | SOME {master, files, ...} => |
159 (case master of SOME m => [#1 (ThyLoad.get_thy m)] | NONE => []) @ |
159 (case master of SOME m => [#1 (ThyLoad.get_thy m)] | NONE => []) @ |
160 (List.mapPartial (Option.map #1 o #2) files)); |
160 (map_filter (Option.map #1 o #2) files)); |
161 |
161 |
162 fun get_preds name = |
162 fun get_preds name = |
163 (thy_graph Graph.imm_preds name) handle Graph.UNDEF _ => |
163 (thy_graph Graph.imm_preds name) handle Graph.UNDEF _ => |
164 error (loader_msg "nothing known about theory" [name]); |
164 error (loader_msg "nothing known about theory" [name]); |
165 |
165 |
220 else SOME name; |
220 else SOME name; |
221 |
221 |
222 in |
222 in |
223 |
223 |
224 fun touch_thys names = |
224 fun touch_thys names = |
225 List.app outdate_thy (thy_graph Graph.all_succs (List.mapPartial check_unfinished names)); |
225 List.app outdate_thy (thy_graph Graph.all_succs (map_filter check_unfinished names)); |
226 |
226 |
227 fun touch_thy name = touch_thys [name]; |
227 fun touch_thy name = touch_thys [name]; |
228 fun touch_child_thys name = touch_thys (thy_graph Graph.imm_succs name); |
228 fun touch_child_thys name = touch_thys (thy_graph Graph.imm_succs name); |
229 |
229 |
230 fun touch_all_thys () = List.app outdate_thy (get_names ()); |
230 fun touch_all_thys () = List.app outdate_thy (get_names ()); |
296 val master = |
296 val master = |
297 if really then ThyLoad.load_thy dir name ml time |
297 if really then ThyLoad.load_thy dir name ml time |
298 else #1 (ThyLoad.deps_thy dir name ml); |
298 else #1 (ThyLoad.deps_thy dir name ml); |
299 |
299 |
300 val files = get_files name; |
300 val files = get_files name; |
301 val missing_files = List.mapPartial (fn (path, NONE) => SOME (Path.pack path) | _ => NONE) files; |
301 val missing_files = map_filter (fn (path, NONE) => SOME (Path.pack path) | _ => NONE) files; |
302 in |
302 in |
303 if null missing_files then () |
303 if null missing_files then () |
304 else warning (loader_msg "unresolved dependencies of theory" [name] ^ |
304 else warning (loader_msg "unresolved dependencies of theory" [name] ^ |
305 " on file(s): " ^ commas_quote missing_files); |
305 " on file(s): " ^ commas_quote missing_files); |
306 change_deps name (fn _ => SOME (make_deps true false (SOME master) files)); |
306 change_deps name (fn _ => SOME (make_deps true false (SOME master) files)); |
432 |
432 |
433 val theory = Theory.begin_theory name (map get_theory bparents); |
433 val theory = Theory.begin_theory name (map get_theory bparents); |
434 val deps = |
434 val deps = |
435 if known_thy name then get_deps name |
435 if known_thy name then get_deps name |
436 else (init_deps NONE (map #1 uses)); (*records additional ML files only!*) |
436 else (init_deps NONE (map #1 uses)); (*records additional ML files only!*) |
437 val uses_now = List.mapPartial (fn (x, true) => SOME x | _ => NONE) uses; |
437 val uses_now = map_filter (fn (x, true) => SOME x | _ => NONE) uses; |
438 |
438 |
439 val _ = change_thys (update_node name bparents (deps, SOME (Theory.copy theory))); |
439 val _ = change_thys (update_node name bparents (deps, SOME (Theory.copy theory))); |
440 val theory' = theory |> present dir' name bparents uses; |
440 val theory' = theory |> present dir' name bparents uses; |
441 val _ = put_theory name (Theory.copy theory'); |
441 val _ = put_theory name (Theory.copy theory'); |
442 val ((), theory'') = Context.pass_theory theory' (List.app (load_file false)) uses_now; |
442 val ((), theory'') = Context.pass_theory theory' (List.app (load_file false)) uses_now; |
468 |
468 |
469 val nonfinished = filter_out is_finished parent_names; |
469 val nonfinished = filter_out is_finished parent_names; |
470 fun get_variant (x, y_name) = |
470 fun get_variant (x, y_name) = |
471 if Theory.eq_thy (x, get_theory y_name) then NONE |
471 if Theory.eq_thy (x, get_theory y_name) then NONE |
472 else SOME y_name; |
472 else SOME y_name; |
473 val variants = List.mapPartial get_variant (parents ~~ parent_names); |
473 val variants = map_filter get_variant (parents ~~ parent_names); |
474 |
474 |
475 fun register G = |
475 fun register G = |
476 (Graph.new_node (name, (NONE, SOME theory)) G |
476 (Graph.new_node (name, (NONE, SOME theory)) G |
477 handle Graph.DUP _ => err "duplicate theory entry" []) |
477 handle Graph.DUP _ => err "duplicate theory entry" []) |
478 |> add_deps name parent_names; |
478 |> add_deps name parent_names; |