3 let rank_all_dependencies = true
4 let trust_environment = false
9 let do_indent () = String.make !indent ' ' in
11 | `Start_type_checking s -> ();
13 prerr_endline (do_indent () ^ "Start: " ^ NUri.string_of_uri s);
16 | `Type_checking_completed s -> ();
19 prerr_endline (do_indent () ^ "End: " ^ NUri.string_of_uri s))
23 HelmLogger.register_log_callback
24 (fun ?append_NL html_msg ->
25 prerr_endline (HelmLogger.string_of_html_msg html_msg));
26 CicParser.impredicative_set := false;
27 NCicTypeChecker.set_logger logger;
28 NCicPp.set_ppterm NCicPp.trivial_pp_term;
29 Helm_registry.load_from "conf.xml";
32 let s = Sys.argv.(1) in
33 if s = "-alluris" then
35 let uri_re = Str.regexp ".*\\(ind\\|con\\)$" in
36 let uris = Http_getter.getalluris () in
37 let alluris = List.filter (fun u -> Str.string_match uri_re u 0) uris in
38 let oc = open_out "alluris.txt" in
39 List.iter (fun s -> output_string oc (s^"\n")) alluris;
44 with Invalid_argument _ ->
46 let ic = open_in "alluris.txt" in
47 try while true do r := input_line ic :: !r; done; []
52 (fun u -> try Some (UriManager.uri_of_string u) with _ -> None) alluris
55 prerr_endline "computing graphs to load...";
57 if not rank_all_dependencies then
60 let dbd = HSql.quick_connect (LibraryDb.parse_dbd_conf ()) in
61 MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
63 HExtlib.list_uniq (List.sort UriManager.compare l) in
65 uniq (List.map (fun (uri,_) -> UriManager.strip_xpointer uri)
66 (MetadataDeps.inverse_deps ~dbd u)) in
69 List.fold_left (fun (acc,todo) x ->
71 if w = [] then (x::acc,todo) else (acc,uniq (todo@w)))
74 if todo = [] then uniq acc else fix acc todo
78 prerr_endline "generating Coq graphs...";
79 CicEnvironment.set_trust (fun _ -> trust_environment);
82 prerr_endline (" - " ^ UriManager.string_of_uri u);
84 ignore(CicTypeChecker.typecheck u);
86 | CicTypeChecker.AssertFailure s
87 | CicTypeChecker.TypeCheckerFailure s ->
88 prerr_endline (Lazy.force s);
91 prerr_endline "loading...";
94 prerr_endline (" - "^UriManager.string_of_uri u);
95 try NCicEnvironment.load_graph u with exn -> ())
97 prerr_endline "finished....";
98 CicUniv.do_rank (NCicEnvironment.get_graph ());
99 prerr_endline "caching objects";
100 prerr_endline "ranked....";
101 HExtlib.profiling_enabled := false;
103 let uu= NUri.nuri_of_ouri uu in
105 logger (`Start_type_checking uu);
106 let _,o = NCicEnvironment.get_obj uu in
108 NCicTypeChecker.typecheck_obj o;
109 logger (`Type_checking_completed uu);
111 | NCicTypeChecker.AssertFailure s
112 | NCicTypeChecker.TypeCheckerFailure s as e ->
113 prerr_endline ("######### " ^ Lazy.force s);
114 if not ignore_exc then raise e
115 | CicEnvironment.Object_not_found s ->
116 prerr_endline ("Obj not found: " ^ UriManager.string_of_uri s)
119 NCicEnvironment.invalidate ();
121 HExtlib.profiling_enabled := true;
122 NCicTypeChecker.set_logger (fun _ -> ());
123 prerr_endline "typechecking, first with the new and then with the old kernel";
124 let prima = Unix.gettimeofday () in
127 let u= NUri.nuri_of_ouri u in
129 NCicTypeChecker.typecheck_obj (snd (NCicEnvironment.get_obj u)))
131 let dopo = Unix.gettimeofday () in
133 let dopo2 = Unix.gettimeofday () in
134 Printf.eprintf "NEW typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo);
135 CicEnvironment.invalidate ();
137 let prima = Unix.gettimeofday () in
138 List.iter (fun u -> ignore (CicTypeChecker.typecheck u)) alluris;
139 let dopo = Unix.gettimeofday () in
141 let dopo2 = Unix.gettimeofday () in
142 Printf.eprintf "OLD typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo)