]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/bin/recomm/recomm.ml
a2336ad9c058a0301a2a3e3d7483c828488ce415
[helm.git] / matita / matita / contribs / lambdadelta / bin / recomm / recomm.ml
1 module EC = RecommCheck
2 module EL = RecommLexer
3 module EI = RecommInput
4 module EO = RecommOutput
5
6 module P1 = RecommPccFor
7 module P2 = RecommPcsAnd
8
9 module G = RecommGc
10
11 let write = ref false
12
13 let chdir path =
14   Sys.chdir path
15
16 let rec process path name =
17   let file = Filename.concat path name in 
18   if Sys.is_directory file then begin
19     let dir = Sys.readdir file in
20     Array.iter (process file) dir
21   end else
22   if Filename.extension file = ".ma" then begin
23     Printf.eprintf "processing: %S\n" file;
24     let orig = EI.read_srcs file in
25     let lint = EC.recomm_srcs orig in
26     if !write && lint <> orig then EO.write_srcs file lint
27   end else begin
28     Printf.eprintf "skipping: %S\n" file
29   end
30
31 let msg_C = "<dir>  Set this working directory (default: .)"
32 let msg_L = " Log lexer tokens (default: no)"
33 let msg_c = "<int>  Set these output columns (default: 78)"
34 let msg_d = " Log with dark colors (default: no)"
35 let msg_k = " Log key comments (default: no)"
36 let msg_m = " Log mark comments (default: no)"
37 let msg_n = " Log with no colors (default: yes)"
38 let msg_o = " Log other comments (default: no)"
39 let msg_s = " Log section comments (default: no)"
40 let msg_t = " Log title comments (default: no)"
41 let msg_w = " Write the output files (default: no)"
42
43 let main =
44   Arg.parse [
45     "-C", Arg.String chdir, msg_C;
46     "-L", Arg.Set EL.debug, msg_m;
47     "-c", Arg.Int ((:=) EO.width), msg_c;
48     "-d", Arg.Clear EC.bw, msg_d;
49     "-k", Arg.Set EC.log_k, msg_k;
50     "-m", Arg.Set EC.log_m, msg_m;
51     "-n", Arg.Set EC.bw, msg_n;
52     "-o", Arg.Set EC.log_o, msg_o;
53     "-s", Arg.Set EC.log_s, msg_s;
54     "-t", Arg.Set EC.log_t, msg_t;
55     "-w", Arg.Set write, msg_w;
56   ] (process "") ""