]> matita.cs.unibo.it Git - helm.git/blob - helm/interface/fix_params.ml
Initial revision
[helm.git] / helm / interface / fix_params.ml
1 let read_from_stdin = ref false;;
2
3 let uri_of_filename fn =
4  let uri =
5   Str.replace_first (Str.regexp (Str.quote Configuration.helm_dir)) "cic:" fn
6  in
7   let uri' = Str.replace_first (Str.regexp "\.xml$") "" uri in
8    UriManager.uri_of_string uri'
9 ;;
10
11 let main() =
12   Deannotate.expect_possible_parameters := true ;
13   let files = ref [] in
14   Arg.parse
15    ["-stdin", Arg.Set read_from_stdin, "Read from stdin"]
16    (fun x -> files := (x, uri_of_filename x) :: !files)
17       "
18 usage: experiment file ...
19
20 List of options:";
21   if !read_from_stdin then
22    begin
23     try
24      while true do
25       let l = Str.split (Str.regexp " ") (read_line ()) in
26        List.iter (fun x -> files := (x, uri_of_filename x) :: !files) l
27      done
28     with
29      End_of_file -> ()
30    end ;
31   files := List.rev !files;
32   Getter.update () ;
33   print_endline "ATTENTION: have you changed servers.txt so that you'll try \
34    to repair your own objs instead of others'?" ;
35   flush stdout ;
36   List.iter
37     (function (fn, uri) ->
38       print_string (UriManager.string_of_uri uri) ;
39       flush stdout ;
40       (try
41        CicFindParameters.fix_params uri (Some fn)
42       with
43         e -> print_newline () ; flush stdout ; raise e ) ;
44       print_endline " OK!" ;
45       flush stdout
46     ) !files
47 ;;
48
49 main();;