1 let read_from_stdin = ref false;;
2 let uris_in_input = ref false;;
3 let reduction_only = ref false;;
6 print_endline ("^^^" ^ uri ^ "^^^") ;
7 print_string (CicPp.ppobj (CicCache.get_obj (UriManager.uri_of_string uri))) ;
8 print_endline ("\n$$$" ^ uri ^ "$$$\n")
11 let uri_of_filename fn =
12 if !uris_in_input then fn
15 Str.replace_first (Str.regexp (Str.quote Configuration.helm_dir)) "cic:" fn
17 let uri' = Str.replace_first (Str.regexp "\.xml$") "" uri in
21 (* filenames are read from command line and converted to uris via *)
22 (* uri_of_filenames; then the cic terms are load in cache via *)
23 (* CicCache.get_obj and then pretty printed via CicPp.ppobj *)
25 exception NotADefinition;;
30 ["-stdin", Arg.Set read_from_stdin, "Read from stdin" ;
31 "-uris", Arg.Set uris_in_input, "Read uris, not filenames" ;
32 "-update", Arg.Unit Getter.update, "Update the getter view of the world" ;
33 "-reduction", Arg.Set reduction_only, "Do reduction instead of tyepchecking"]
34 (fun x -> files := (uri_of_filename x) :: !files)
36 usage: experiment file ...
39 if !read_from_stdin then
43 let l = Str.split (Str.regexp " ") (read_line ()) in
44 List.iter (fun x -> files := (uri_of_filename x) :: !files) l
49 files := List.rev !files;
55 if !reduction_only then
56 match CicCache.get_obj (UriManager.uri_of_string x) with
57 Cic.Definition (_,bo,_,_) ->
58 CicTypeChecker.typecheck (UriManager.uri_of_string x) ;
59 ignore (CicReduction.whd bo)
60 | _ -> raise NotADefinition
62 CicTypeChecker.typecheck (UriManager.uri_of_string x)
64 e -> print_newline () ; flush stdout ; raise e ) ;
65 print_endline " OK!" ;