]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/interface/fix_params.ml
Initial revision
[helm.git] / helm / interface / fix_params.ml
diff --git a/helm/interface/fix_params.ml b/helm/interface/fix_params.ml
new file mode 100644 (file)
index 0000000..b4de9fa
--- /dev/null
@@ -0,0 +1,49 @@
+let read_from_stdin = ref false;;
+
+let uri_of_filename fn =
+ let uri =
+  Str.replace_first (Str.regexp (Str.quote Configuration.helm_dir)) "cic:" fn
+ in
+  let uri' = Str.replace_first (Str.regexp "\.xml$") "" uri in
+   UriManager.uri_of_string uri'
+;;
+
+let main() =
+  Deannotate.expect_possible_parameters := true ;
+  let files = ref [] in
+  Arg.parse
+   ["-stdin", Arg.Set read_from_stdin, "Read from stdin"]
+   (fun x -> files := (x, uri_of_filename x) :: !files)
+      "
+usage: experiment file ...
+
+List of options:";
+  if !read_from_stdin then
+   begin
+    try
+     while true do
+      let l = Str.split (Str.regexp " ") (read_line ()) in
+       List.iter (fun x -> files := (x, uri_of_filename x) :: !files) l
+     done
+    with
+     End_of_file -> ()
+   end ;
+  files := List.rev !files;
+  Getter.update () ;
+  print_endline "ATTENTION: have you changed servers.txt so that you'll try \
+   to repair your own objs instead of others'?" ;
+  flush stdout ;
+  List.iter
+    (function (fn, uri) ->
+      print_string (UriManager.string_of_uri uri) ;
+      flush stdout ;
+      (try
+       CicFindParameters.fix_params uri (Some fn)
+      with
+        e -> print_newline () ; flush stdout ; raise e ) ;
+      print_endline " OK!" ;
+      flush stdout
+    ) !files
+;;
+
+main();;