3 (* let do_indent () = String.make !indent ' ' in *)
4 NCicTypeChecker.set_logger
6 | `Start_type_checking s -> ();
7 (* prerr_endline (do_indent () ^ "Start: " ^ NUri.string_of_uri s); *)
10 | `Type_checking_completed s -> ();
12 (* prerr_endline (do_indent () ^ "End: " ^ NUri.string_of_uri s) *)
14 NCicPp.set_ppterm NCicPp.trivial_pp_term;
15 Helm_registry.load_from "conf.xml";
18 let s = Sys.argv.(1) in
19 if s = "-alluris" then
21 let uri_re = Str.regexp ".*\\(ind\\|con\\)$" in
22 let uris = Http_getter.getalluris () in
23 let alluris = List.filter (fun u -> Str.string_match uri_re u 0) uris in
24 let oc = open_out "alluris.txt" in
25 List.iter (fun s -> output_string oc (s^"\n")) alluris;
30 with Invalid_argument _ ->
32 let ic = open_in "alluris.txt" in
33 try while true do r := input_line ic :: !r; done; []
38 (fun u -> try Some (UriManager.uri_of_string u) with _ -> None) alluris
41 prerr_endline "computing graphs to load...";
42 let dbd = HSql.quick_connect (LibraryDb.parse_dbd_conf ()) in
43 MetadataTypes.ownerize_tables (Helm_registry.get "matita.owner");
45 HExtlib.list_uniq (List.sort UriManager.compare l)
48 uniq (List.map fst (MetadataDeps.inverse_deps ~dbd u))
53 List.fold_left (fun (acc,todo) x ->
55 if w = [] then (x::acc,todo) else (acc,uniq (todo@w)))
58 if todo = [] then uniq acc else fix acc todo
62 prerr_endline "generating Coq graphs...";
63 CicEnvironment.set_trust (fun _ -> false);
65 prerr_endline (" - " ^ UriManager.string_of_uri u);
66 ignore(CicTypeChecker.typecheck u);
68 prerr_endline "loading...";
71 prerr_endline (" - "^UriManager.string_of_uri u);
72 try NCicEnvironment.load_graph u with exn -> ())
74 prerr_endline "finished....";
75 CicUniv.do_rank (NCicEnvironment.get_graph ());
76 prerr_endline "ranked....";
77 prerr_endline "caching objects";
78 HExtlib.profiling_enabled := false;
80 let uu= NUri.nuri_of_ouri uu in
82 (* prerr_endline ("************* INIZIO **************** " ^ NUri.string_of_uri uu); *)
83 let _,o = NCicEnvironment.get_obj uu in
84 (* prerr_endline (NCicPp.ppobj o); *)
86 NCicTypeChecker.typecheck_obj o;
87 (* prerr_endline ("************* FINE ****************" ^ NUri.string_of_uri uu); *)
89 | NCicTypeChecker.AssertFailure s
90 | NCicTypeChecker.TypeCheckerFailure s as e ->
91 (* prerr_endline ("Obj: " ^ NCicPp.ppobj o); *)
92 prerr_endline ("######### " ^ Lazy.force s); raise e
93 | CicEnvironment.Object_not_found s ->
94 prerr_endline ("Obj not found: " ^ UriManager.string_of_uri s);
97 NCicEnvironment.invalidate ();
99 HExtlib.profiling_enabled := true;
100 prerr_endline "typechecking, first with the new and then with the old kernel";
101 let prima = Unix.gettimeofday () in
104 let u= NUri.nuri_of_ouri u in
106 NCicTypeChecker.typecheck_obj (snd (NCicEnvironment.get_obj u)))
108 let dopo = Unix.gettimeofday () in
110 let dopo2 = Unix.gettimeofday () in
111 Printf.eprintf "NEW typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo);
112 CicEnvironment.invalidate ();
114 let prima = Unix.gettimeofday () in
115 List.iter (fun u -> ignore (CicTypeChecker.typecheck u)) alluris;
116 let dopo = Unix.gettimeofday () in
118 let dopo2 = Unix.gettimeofday () in
119 Printf.eprintf "OLD typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo)