equal
deleted
inserted
replaced
17 end; |
17 end; |
18 |
18 |
19 signature THY_LOAD = |
19 signature THY_LOAD = |
20 sig |
20 sig |
21 include BASIC_THY_LOAD |
21 include BASIC_THY_LOAD |
22 val cond_with_path: Path.T -> ('a -> 'b) -> 'a -> 'b |
22 val cond_add_path: Path.T -> ('a -> 'b) -> 'a -> 'b |
23 val ml_path: string -> Path.T |
23 val ml_path: string -> Path.T |
24 val thy_path: string -> Path.T |
24 val thy_path: string -> Path.T |
25 val check_file: Path.T -> (Path.T * File.info) option |
25 val check_file: Path.T -> (Path.T * File.info) option |
26 val load_file: Path.T -> (Path.T * File.info) |
26 val load_file: Path.T -> (Path.T * File.info) |
27 eqtype master |
27 eqtype master |
50 |
50 |
51 fun show_path () = map Path.pack (! load_path); |
51 fun show_path () = map Path.pack (! load_path); |
52 fun add_path s = change_path (cons (Path.unpack s)); |
52 fun add_path s = change_path (cons (Path.unpack s)); |
53 fun del_path s = change_path (filter_out (equal (Path.unpack s))); |
53 fun del_path s = change_path (filter_out (equal (Path.unpack s))); |
54 fun reset_path () = load_path := [Path.current]; |
54 fun reset_path () = load_path := [Path.current]; |
55 fun with_path s f x = Library.setmp load_path (Path.unpack s :: ! load_path) f x; |
55 fun with_paths ss f x = Library.setmp load_path (! load_path @ map Path.unpack ss) f x; |
56 fun with_paths ss f x = Library.setmp load_path (map Path.unpack ss @ ! load_path) f x; |
56 fun with_path s f x = with_paths [s] f x; |
57 |
57 |
58 fun cond_with_path path f x = |
58 fun cond_add_path path f x = |
59 if Path.is_current path then f x else Library.setmp load_path (path :: ! load_path) f x; |
59 if Path.is_current path then f x else Library.setmp load_path (path :: ! load_path) f x; |
60 |
60 |
61 |
61 |
62 (* file formats *) |
62 (* file formats *) |
63 |
63 |
106 commas_quote (show_path ())) |
106 commas_quote (show_path ())) |
107 | Some thy_info => (thy_info, if ml then check_file (ml_path name) else None)); |
107 | Some thy_info => (thy_info, if ml then check_file (ml_path name) else None)); |
108 |
108 |
109 in |
109 in |
110 |
110 |
111 fun check_thy dir name ml = Master (cond_with_path dir check_thy_aux (name, ml)); |
111 fun check_thy dir name ml = Master (cond_add_path dir check_thy_aux (name, ml)); |
112 |
112 |
113 fun process_thy dir f name ml = |
113 fun process_thy dir f name ml = |
114 let val master as Master ((path, _), _) = check_thy dir name ml |
114 let val master as Master ((path, _), _) = check_thy dir name ml |
115 in (master, cond_with_path dir f path) end; |
115 in (master, cond_add_path dir f path) end; |
116 |
116 |
117 end; |
117 end; |
118 |
118 |
119 |
119 |
120 (* deps_thy and load_thy *) |
120 (* deps_thy and load_thy *) |