diff --git a/src/dune b/src/dune
index 50199be2..cb5b9baf 100644
--- a/src/dune
+++ b/src/dune
@@ -19,6 +19,7 @@
unix
threads
str
+ cmdliner
dune-site
dune-build-info
camlzip ; main deps.
diff --git a/src/tlapm_args.ml b/src/tlapm_args.ml
index 48c8599d..c73dd608 100644
--- a/src/tlapm_args.ml
+++ b/src/tlapm_args.ml
@@ -6,7 +6,6 @@ open Ext
open Params
-let show_config = ref false
let show_version () =
print_endline (rawversion ()) ;
exit 0
@@ -52,16 +51,6 @@ let set_default_method meth =
with Failure msg -> raise (Arg.Bad ("--method: " ^ msg))
-(* FIXME use Arg.parse instead *)
-let parse_args args opts mods usage_fmt =
- try
- Arg.parse_argv (Array.of_list args) opts (fun mfile -> mods := mfile :: !mods)
- (Printf.sprintf usage_fmt (Filename.basename Sys.executable_name))
- with Arg.Bad msg ->
- print_endline msg ;
- flush stdout ;
- exit 2
-
let show_where () =
match stdlib_path with
| Some path ->
@@ -71,10 +60,8 @@ let show_where () =
Printf.printf "N/A\n";
exit 1
-let set_nofp_start s =
- nofp_sl := s
-
-let set_nofp_end e =
+let set_nofp (s, e) =
+ nofp_sl := s;
nofp_el := e
@@ -86,13 +73,9 @@ let print_fp fic =
let use_fp fic =
fpf_in := Some fic
-let erase_fp_file = ref ""
-let set_erase_fp_file fic = erase_fp_file := fic
-
(* FIXME this should share the parsing code with --method
or maybe just remove this option... *)
-let erase_fp backend =
- let fic = !erase_fp_file in
+let erase_fp (fic, backend) =
if (not (Sys.file_exists fic)) then begin
raise (Arg.Bad (Printf.sprintf "File %s does not exist." fic));
end;
@@ -111,16 +94,6 @@ let erase_fp backend =
exit 0
-let deprecated flag nargs =
- let f _ = Printf.eprintf "Warning: %s is deprecated (ignored)\n%!" flag in
- match nargs with
- | 0 -> flag, Arg.Unit f, ""
- | 1 -> flag, Arg.String f, ""
- | _ ->
- let args = Array.to_list (Array.make nargs (Arg.String f)) in
- flag, Arg.Tuple args, ""
-
-
let quote_if_needed s =
let check c =
match c with
@@ -134,140 +107,254 @@ let quote_if_needed s =
end
-let init () =
- let mods = ref [] in
- let helpfn = ref (fun () -> ()) in
- let show_help () = !helpfn () in
- let sep = Arg.Unit show_help in
- let blank = "", sep, " " in
- let title s = s, sep, " " in
- let opts = [
- blank;
- title "(basic options)";
- blank;
- "--help", Arg.Unit show_help, " show this help message and exit" ;
- "-help", Arg.Unit show_help, " (same as --help)" ;
- "--version", Arg.Unit show_version, " show version number and exit" ;
- "--verbose", Arg.Set verbose, " produce verbose messages" ;
- "-v", Arg.Set verbose, " (same as --verbose)" ;
- blank;
- "--where", Arg.Unit show_where,
- " show location of standard library and exit" ;
- "--config", Arg.Set show_config, " show configuration and exit" ;
- "--summary", Arg.Set summary,
- " show summary of theorems (implies -N and not -C)" ;
- "--timing", Arg.Set stats, " show runtime statistics" ;
- blank;
- "-I", Arg.String add_search_dir, "
add to search path" ;
- deprecated "-d" 1;
- blank;
- "-k", Arg.Set keep_going, " keep going on backend failures" ;
- "-N", Arg.Set suppress_all, " do not run any backend verifiers" ;
- "-C", Arg.Set check, " check proofs in Isabelle/TLA+" ;
- blank;
- "--threads", Arg.Int set_max_threads,
- " set number of worker threads to " ;
- "--method", Arg.String set_default_method,
- " set default method to (try --method help)" ;
- "--solver", Arg.String set_smt_solver,
- " set SMT solver to ";
- "--smt-logic", Arg.String set_smt_logic,
- " set SMT logic to ";
- "--fast-isabelle", Arg.Unit Params.set_fast_isabelle,
- " (Windows-only) Launch Isabelle with fast shortcut";
- "--stretch", Arg.Set_float Params.timeout_stretch,
- " multiply all timeouts by ";
- blank;
- title "(advanced options)" ;
- blank;
- "--noflatten", Arg.Clear ob_flatten, " do not flatten obligations" ;
- "--nonormal", Arg.Clear pr_normal,
- " do not normalize obligations before printing" ;
- "--debug", Arg.String set_debug_flags,
- "{[-]} enable/disable debugging flags" ;
- deprecated "--paranoid" 0;
- deprecated "--isaprove" 0;
- blank;
- "--toolbox", (Arg.Tuple [Arg.Int set_target_start;Arg.Int set_target_end]),
- " toolbox mode";
- "--toolbox-vsn", (Arg.Int set_toolbox_vsn),
- " Toolbox protocol version, 1|2, 1 by default.";
- "--line", Arg.Int set_target_line,
- " line to prove";
- "--wait", Arg.Set_int wait,
- "