3 let rank_all_dependencies = true
4 let trust_environment = false
8 let load_graph, get_graph =
9 let oldg = ref CicUniv.empty_ugraph in
11 let _,g = CicEnvironment.get_obj !oldg uri in
17 let do_indent () = String.make !indent ' ' in
19 | `Start_type_checking s ->
21 prerr_endline (do_indent () ^ "Start: " ^ NUri.string_of_uri s);
23 | `Type_checking_completed s ->
26 prerr_endline (do_indent () ^ "End: " ^ NUri.string_of_uri s)
27 | `Type_checking_interrupted s ->
30 prerr_endline (do_indent () ^ "Break: " ^ NUri.string_of_uri s)
31 | `Type_checking_failed s ->
34 prerr_endline (do_indent () ^ "Fail: " ^ NUri.string_of_uri s)
37 prerr_endline (do_indent () ^ "Trust: " ^ NUri.string_of_uri s))
41 let do_old_logging = ref true in
42 HelmLogger.register_log_callback
43 (fun ?append_NL html_msg ->
44 if !do_old_logging then
45 prerr_endline (HelmLogger.string_of_html_msg html_msg));
46 CicParser.impredicative_set := false;
47 NCicTypeChecker.set_logger logger;
48 NCicPp.set_ppterm NCicPp.trivial_pp_term;
49 Helm_registry.load_from "conf.xml";
52 let s = Sys.argv.(1) in
53 if s = "-alluris" then
55 let uri_re = Str.regexp ".*\\(ind\\|con\\)$" in
56 let uris = Http_getter.getalluris () in
57 let alluris = List.filter (fun u -> Str.string_match uri_re u 0) uris in
58 let oc = open_out "alluris.txt" in
59 List.iter (fun s -> output_string oc (s^"\n")) alluris;
64 with Invalid_argument _ ->
66 let ic = open_in "alluris.txt" in
67 try while true do r := input_line ic :: !r; done; []
72 (fun u -> try Some (UriManager.uri_of_string u) with _ -> None) alluris
75 prerr_endline "computing graphs to load...";
77 if not rank_all_dependencies then
80 let dbd = HSql.quick_connect (LibraryDb.parse_dbd_conf ()) in
81 MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
83 HExtlib.list_uniq (List.sort UriManager.compare l) in
85 uniq (List.map (fun (uri,_) -> UriManager.strip_xpointer uri)
86 (MetadataDeps.inverse_deps ~dbd u)) in
89 List.fold_left (fun (acc,todo) x ->
91 if w = [] then (x::acc,todo) else (acc,uniq (todo@w)))
94 if todo = [] then uniq acc else fix acc todo
98 prerr_endline "generating Coq graphs...";
99 CicEnvironment.set_trust (fun _ -> trust_environment);
102 prerr_endline (" - " ^ UriManager.string_of_uri u);
104 ignore(CicTypeChecker.typecheck u);
106 | CicTypeChecker.AssertFailure s
107 | CicTypeChecker.TypeCheckerFailure s ->
108 prerr_endline (Lazy.force s);
111 prerr_endline "loading...";
114 prerr_endline (" - "^UriManager.string_of_uri u);
115 try load_graph u with exn -> ())
117 prerr_endline "finished....";
118 CicUniv.do_rank (get_graph ());
119 prerr_endline "caching objects";
120 prerr_endline "ranked....";
121 HExtlib.profiling_enabled := false;
123 let uu= NUri.nuri_of_ouri uu in
125 let o = NCicLibrary.get_obj uu in
127 NCicTypeChecker.typecheck_obj o
129 | NCicTypeChecker.AssertFailure s
130 | NCicTypeChecker.TypeCheckerFailure s as e ->
131 prerr_endline ("######### " ^ Lazy.force s);
132 if not ignore_exc then raise e
133 | NCicEnvironment.Object_not_found s ->
134 prerr_endline ("Obj not found: " ^ UriManager.string_of_uri s)
137 NCicEnvironment.invalidate ();
139 HExtlib.profiling_enabled := true;
140 NCicTypeChecker.set_logger (fun _ -> ());
141 do_old_logging := false;
142 prerr_endline "typechecking, first with the new and then with the old kernel";
143 let prima = Unix.gettimeofday () in
146 let u= NUri.nuri_of_ouri u in
148 NCicTypeChecker.typecheck_obj (NCicLibrary.get_obj u))
150 let dopo = Unix.gettimeofday () in
152 let dopo2 = Unix.gettimeofday () in
153 Printf.eprintf "NEW typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo);
154 CicEnvironment.invalidate ();
156 let prima = Unix.gettimeofday () in
157 List.iter (fun u -> ignore (CicTypeChecker.typecheck u)) alluris;
158 let dopo = Unix.gettimeofday () in
160 let dopo2 = Unix.gettimeofday () in
161 Printf.eprintf "OLD typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo)