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 "loading graphs...";
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
64 prerr_endline (" - "^UriManager.string_of_uri u);
65 try NCicEnvironment.load_graph u with exn -> ())
67 prerr_endline "finished....";
68 CicUniv.do_rank (NCicEnvironment.get_graph ());
69 prerr_endline "ranked....";
70 prerr_endline "caching objects";
71 HExtlib.profiling_enabled := false;
73 let uu= NUri.nuri_of_ouri uu in
75 (* prerr_endline ("************* INIZIO **************** " ^ NUri.string_of_uri uu); *)
76 let _,o = NCicEnvironment.get_obj uu in
77 (* prerr_endline (NCicPp.ppobj o); *)
79 NCicTypeChecker.typecheck_obj o;
80 (* prerr_endline ("************* FINE ****************" ^ NUri.string_of_uri uu); *)
82 | NCicTypeChecker.AssertFailure s
83 | NCicTypeChecker.TypeCheckerFailure s as e ->
84 (* prerr_endline ("Obj: " ^ NCicPp.ppobj o); *)
85 prerr_endline ("######### " ^ Lazy.force s); raise e
86 | CicEnvironment.Object_not_found s ->
87 prerr_endline ("Obj not found: " ^ UriManager.string_of_uri s);
90 NCicEnvironment.invalidate ();
92 HExtlib.profiling_enabled := true;
93 prerr_endline "typechecking, first with the new and then with the old kernel";
94 let prima = Unix.gettimeofday () in
97 let u= NUri.nuri_of_ouri u in
99 NCicTypeChecker.typecheck_obj (snd (NCicEnvironment.get_obj u)))
101 let dopo = Unix.gettimeofday () in
103 let dopo2 = Unix.gettimeofday () in
104 Printf.eprintf "NEW typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo);
105 CicEnvironment.invalidate ();
107 let prima = Unix.gettimeofday () in
108 List.iter (fun u -> ignore (CicTypeChecker.typecheck u)) alluris;
109 let dopo = Unix.gettimeofday () in
111 let dopo2 = Unix.gettimeofday () in
112 Printf.eprintf "OLD typing: %3.2f, gc: %3.2f\n%!" (dopo -. prima) (dopo2 -. dopo)