]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/bin/recomm/recomm.ml
propagating the arithmetics library, partial commit
[helm.git] / matita / matita / contribs / lambdadelta / bin / recomm / recomm.ml
index a2336ad9c058a0301a2a3e3d7483c828488ce415..87caeb10b960a18857265629d23863866106b30b 100644 (file)
@@ -5,14 +5,30 @@ module EO = RecommOutput
 
 module P1 = RecommPccFor
 module P2 = RecommPcsAnd
+module P3 = RecommPcsPar
 
 module G = RecommGc
 
 let write = ref false
 
+let force = ref false
+
+let subst = ref None
+
 let chdir path =
   Sys.chdir path
 
+let start_substs () =
+  subst := Some (open_out "subst.txt")
+
+let write_substs lint = function
+  | None     -> ()
+  | Some och -> EO.write_substs och lint
+
+let stop_substs = function
+  | None     -> ()
+  | Some och -> close_out och
+
 let rec process path name =
   let file = Filename.concat path name in 
   if Sys.is_directory file then begin
@@ -23,7 +39,8 @@ let rec process path name =
     Printf.eprintf "processing: %S\n" file;
     let orig = EI.read_srcs file in
     let lint = EC.recomm_srcs orig in
-    if !write && lint <> orig then EO.write_srcs file lint
+    write_substs lint !subst;
+    if !force || (!write && lint <> orig) then EO.write_srcs file lint
   end else begin
     Printf.eprintf "skipping: %S\n" file
   end
@@ -32,13 +49,16 @@ let msg_C = "<dir>  Set this working directory (default: .)"
 let msg_L = " Log lexer tokens (default: no)"
 let msg_c = "<int>  Set these output columns (default: 78)"
 let msg_d = " Log with dark colors (default: no)"
+let msg_f = " Write all output files (default: no)"
 let msg_k = " Log key comments (default: no)"
 let msg_m = " Log mark comments (default: no)"
 let msg_n = " Log with no colors (default: yes)"
 let msg_o = " Log other comments (default: no)"
+let msg_r = " Replace the input files (default: no)"
 let msg_s = " Log section comments (default: no)"
 let msg_t = " Log title comments (default: no)"
-let msg_w = " Write the output files (default: no)"
+let msg_u = " Write substitution file (default: no)"
+let msg_w = " Write the changed output files (default: no)"
 
 let main =
   Arg.parse [
@@ -46,11 +66,15 @@ let main =
     "-L", Arg.Set EL.debug, msg_m;
     "-c", Arg.Int ((:=) EO.width), msg_c;
     "-d", Arg.Clear EC.bw, msg_d;
+    "-f", Arg.Set force, msg_f;
     "-k", Arg.Set EC.log_k, msg_k;
     "-m", Arg.Set EC.log_m, msg_m;
     "-n", Arg.Set EC.bw, msg_n;
     "-o", Arg.Set EC.log_o, msg_o;
+    "-r", Arg.Set EO.replace, msg_r;
     "-s", Arg.Set EC.log_s, msg_s;
     "-t", Arg.Set EC.log_t, msg_t;
+    "-u", Arg.Unit start_substs, msg_u;
     "-w", Arg.Set write, msg_w;
-  ] (process "") ""
+  ] (process "") "";
+  stop_substs !subst