Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | allocatable | :: | input |
Input file name |
||
integer, | intent(out), | allocatable | :: | input_format |
Input file format |
|
character(len=:), | allocatable | :: | output |
Output file name |
||
integer, | intent(out), | allocatable | :: | output_format |
Output file format |
|
logical, | intent(out) | :: | normalize |
Normalize element symbols |
||
character(len=:), | allocatable | :: | template |
Template file name |
||
integer, | intent(out), | allocatable | :: | template_format |
Template file format |
|
logical, | intent(out) | :: | read_dot_files |
Read information from .CHRG and .UHF files |
||
type(error_type), | intent(out), | allocatable | :: | error |
Error handling |
subroutine get_arguments(input, input_format, output, output_format, normalize, & & template, template_format, read_dot_files, error) !> Input file name character(len=:), allocatable :: input !> Input file format integer, allocatable, intent(out) :: input_format !> Output file name character(len=:), allocatable :: output !> Output file format integer, allocatable, intent(out) :: output_format !> Template file name character(len=:), allocatable :: template !> Template file format integer, allocatable, intent(out) :: template_format !> Normalize element symbols logical, intent(out) :: normalize !> Read information from .CHRG and .UHF files logical, intent(out) :: read_dot_files !> Error handling type(error_type), allocatable, intent(out) :: error integer :: iarg, narg character(len=:), allocatable :: arg normalize = .false. read_dot_files = .true. iarg = 0 narg = command_argument_count() do while(iarg < narg) iarg = iarg + 1 call get_argument(iarg, arg) select case(arg) case("--help") call help(output_unit) stop case("--version") call version(output_unit) stop case default if (.not.allocated(input)) then call move_alloc(arg, input) cycle end if if (.not.allocated(output)) then call move_alloc(arg, output) cycle end if call fatal_error(error, "Too many positional arguments present") exit case("-i", "--input") iarg = iarg + 1 call get_argument(iarg, arg) if (.not.allocated(arg)) then call fatal_error(error, "Missing argument for input format") exit end if if (index(arg, ".") == 0) arg = "."//arg input_format = get_filetype(arg) case("-o", "--output") iarg = iarg + 1 call get_argument(iarg, arg) if (.not.allocated(arg)) then call fatal_error(error, "Missing argument for output format") exit end if output_format = get_filetype("."//arg) case("--normalize") normalize = .true. case("--template") iarg = iarg + 1 call get_argument(iarg, template) if (.not.allocated(template)) then call fatal_error(error, "Missing argument for template file") exit end if case("--template-format") iarg = iarg + 1 call get_argument(iarg, arg) if (.not.allocated(arg)) then call fatal_error(error, "Missing argument for template format") exit end if template_format = get_filetype("."//arg) case("--ignore-dot-files") read_dot_files = .false. end select end do if (.not.(allocated(input).and.(allocated(output)))) then if (.not.allocated(error)) then call help(output_unit) error stop end if end if end subroutine get_arguments