- let include_deps = Hashtbl.create (Array.length Sys.argv) in
- let include_deps_dot = Hashtbl.create (Array.length Sys.argv) in
- let baseuri_of = Hashtbl.create (Array.length Sys.argv) in
- let baseuri_of_inv = Hashtbl.create (Array.length Sys.argv) in
- let uri_deps = Hashtbl.create (Array.length Sys.argv) in
- let ma_topo = Hashtbl.create (Array.length Sys.argv) in
- let ma_topo_keys = ref [] in
+ let include_deps = Hashtbl.create 13 in
+ let baseuri_of = Hashtbl.create 13 in
+ let baseuri_of_inv = Hashtbl.create 13 in
+ let dot_name = "depends" in
+ let dot_file = ref "" in
+ let set_dot_file () = dot_file := dot_name^".dot" in
+ let set_excluded_file name = excluded_files := name :: !excluded_files in
+ (* helpers *)
+ let rec baseuri_of_script s =
+ try Hashtbl.find baseuri_of s
+ with Not_found ->
+ let _,b,_,_ =
+ Librarian.baseuri_of_script ~include_paths:!include_paths s
+ in
+ Hashtbl.add baseuri_of s b;
+ Hashtbl.add baseuri_of_inv b s;
+ let _ =
+ if Filename.check_suffix s ".mma" then
+ let generated = Filename.chop_suffix s ".mma" ^ ".ma" in
+ ignore (baseuri_of_script generated)
+ in
+ b
+ in
+ let script_of_baseuri ma b =
+ try Some (Hashtbl.find baseuri_of_inv b)
+ with Not_found ->
+ HLog.error ("Skipping dependency of '"^ma^"' over '"^b^"'");
+ HLog.error ("Please include the file defining such baseuri, or fix");
+ HLog.error ("possibly incorrect verbatim URIs in the .ma file.");
+ None
+ in