Removed core

This commit is contained in:
Anthony Scemama 2019-07-22 12:19:12 +02:00
parent b14fe1dc34
commit 5e25738f53
11 changed files with 38 additions and 26 deletions

View File

@ -12,12 +12,22 @@ type description = {
arg : argument ;
}
(* Mutable variables *)
let anon_args = ref []
and header_doc = ref ""
and description_doc = ref ""
and footer_doc = ref ""
and specs = ref []
let reset () =
anon_args := [];
header_doc := "";
description_doc := "";
footer_doc := "";
specs := []
(* End mutable variables *)
let set_header_doc s = header_doc := s
let set_description_doc s = description_doc := s
let set_footer_doc s = footer_doc := s

View File

@ -124,3 +124,6 @@ val set_specs : description list -> unit
val anon_args : unit -> string list
(** Reset the internal state *)
val reset : unit -> unit

View File

@ -24,6 +24,8 @@ ALL_EXE=$(patsubst %.ml,%.native,$(wildcard qp_*.ml)) qmcchem.native
default: $(ALL_EXE)
mv qmcchem.native $(QMCCHEM_PATH)/bin/qmcchem
tests: $(ALL_TESTS)

View File

@ -62,7 +62,7 @@ let run ~t ezfio_filename=
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -274,7 +274,7 @@ let run ~c ?f ?t ?l ?m ?e ?et ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
write_input_in_ezfio ezfio_filename fields
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -12,7 +12,7 @@ let run ezfio_filename =
ignore @@
Unix.execv prog argv
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -120,7 +120,7 @@ let run ?c ?d ~l ~update ezfio_filename =
| _ -> handle_options ()
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -206,7 +206,7 @@ let run ?a ?c ?e ?h ?t ?p ?rmin ?rmax ezfio_file =
display_summary ~range
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -192,7 +192,7 @@ let run a d ?q ?s ezfio_filename =
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -3,7 +3,7 @@ let run ezfio_filename =
Qputils.set_ezfio_filename ezfio_filename;
Status.write Status.Stopping
let () =
let command () =
let open Command_line in
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");

View File

@ -1,9 +1,11 @@
let update_command_line () =
let last = Array.length Sys.argv - 1 in
let last = (Array.length Sys.argv) - 2 in
Sys.argv.(0) <- Sys.argv.(0) ^ " " ^ Sys.argv.(1);
for i=1 to last do
Sys.argv.(i) <- Sys.argv.(i+1)
done;
Sys.argv.(last) <- "--"
Sys.argv.(last+1) <- "--"
let () =
@ -11,29 +13,24 @@ let () =
begin
set_header_doc (Sys.argv.(0) ^ " - QMC=Chem command");
set_description_doc "Driver for subcommands.";
[
anonymous "COMMAND" Mandatory "[debug|edit|info|md5|result|run|stop]";
anonymous "EZFIO_DIR" Mandatory "EZFIO directory";
]
|> set_specs
set_specs []
end;
let command =
match Command_line.anon_args () with
| command :: ezfio_file :: [] -> command
| _ -> (Command_line.help () ; failwith "Inconsistent command line")
in
if Array.length Sys.argv < 2 then
(Command_line.help (); failwith "Inconsistent command line");
let command = Sys.argv.(1) in
update_command_line ();
Command_line.reset ();
match command with
| "debug" -> let open Qmcchem_debug in ()
| "edit" -> let open Qmcchem_edit in ()
| "info" -> let open Qmcchem_info in ()
| "md5" -> let open Qmcchem_md5 in ()
| "result" -> let open Qmcchem_result in ()
| "run" -> let open Qmcchem_run in ()
| "stop" -> let open Qmcchem_stop in ()
| "debug" -> let open Qmcchem_debug in command ()
| "edit" -> let open Qmcchem_edit in command ()
| "info" -> let open Qmcchem_info in command ()
| "md5" -> let open Qmcchem_md5 in command ()
| "result" -> let open Qmcchem_result in command ()
| "run" -> let open Qmcchem_run in command ()
| "stop" -> let open Qmcchem_stop in command ()
| _ -> (Command_line.help () ; failwith "Inconsistent command line")