FTN_Getopt
Fortran command line processing
Data Types | Functions/Subroutines | Variables
ftn_getopt Module Reference

Data Types

type  opt_t
 Class opt_t. More...
 
interface  optval
 Generic interface optval(type(opt_t) option, <type> value, integer stat) More...
 

Functions/Subroutines

impure elemental type(opt_t) function, public optinit (name, type, short_name, stat)
 Procedure optinit. More...
 
elemental logical function, public optset (option)
 Procedure optset. More...
 
elemental integer function, public optind (option)
 Procedure optind. More...
 
integer function, public optlen (option)
 Procedure optlen. More...
 
subroutine optval_logical (option, value, stat)
 Specific procedure of optval. More...
 
subroutine optval_integer (option, value, stat)
 Specific procedure of optval. More...
 
subroutine optval_real (option, value, stat)
 Specific procedure of optval. More...
 
subroutine optval_string (option, value, stat)
 Specific procedure of optval. More...
 
impure elemental subroutine, public optarg (option, stat)
 Procedure optarg. More...
 

Variables

integer, parameter stat_success = 0
 private More...
 
integer, parameter stat_alloc_fail = 1
 private More...
 
integer, parameter stat_type_unsupp = 2
 private More...
 
integer, parameter stat_type_mismatch = 3
 private More...
 
integer, parameter stat_arg_fail = 4
 private More...
 
integer, parameter stat_option_undef = 5
 private More...
 
logical, dimension(:), allocatable, public, protected optignored
 Unprocessed options. More...
 

Function/Subroutine Documentation

◆ optarg()

impure elemental subroutine, public ftn_getopt::optarg ( type(opt_t), intent(inout)  option,
integer, intent(out), optional  stat 
)

Procedure optarg.

process command line and store the result in supplied option if it is encountered.

◆ optind()

elemental integer function, public ftn_getopt::optind ( type(opt_t), intent(in)  option)

Procedure optind.

Determine position of option on command line (-1 if not set).

◆ optinit()

impure elemental type(opt_t) function, public ftn_getopt::optinit ( character(len=*), intent(in)  name,
character(len=*), intent(in)  type,
character(len=1), intent(in), optional  short_name,
integer, intent(out), optional  stat 
)

Procedure optinit.

Initialize an opt_t object by specifying its name and type. By default, the long option style is supported, but a short option name can be optionally added. A blank or empty string for the short option is equivalent to omission.

Parameters
[in]typemust be one of the values 'integer', 'logical', 'real' or 'string'.

◆ optlen()

integer function, public ftn_getopt::optlen ( type(opt_t), intent(in)  option)

Procedure optlen.

Determine the length of a string type option. Zero is returned if the option is not set or of a different type.

◆ optset()

elemental logical function, public ftn_getopt::optset ( type(opt_t), intent(in)  option)

Procedure optset.

Determine whether option has been set. This is useful after an optarg call, because the program-specified type might be inconsistent with what was supplied on the command line.

◆ optval_integer()

subroutine ftn_getopt::optval_integer ( type(opt_t), intent(in)  option,
integer, intent(inout)  value,
integer, intent(out), optional  stat 
)
private

Specific procedure of optval.

◆ optval_logical()

subroutine ftn_getopt::optval_logical ( type(opt_t), intent(in)  option,
logical, intent(inout)  value,
integer, intent(out), optional  stat 
)
private

Specific procedure of optval.

◆ optval_real()

subroutine ftn_getopt::optval_real ( type(opt_t), intent(in)  option,
real, intent(inout)  value,
integer, intent(out), optional  stat 
)
private

Specific procedure of optval.

◆ optval_string()

subroutine ftn_getopt::optval_string ( type(opt_t), intent(in)  option,
character(len=*), intent(inout)  value,
integer, intent(out), optional  stat 
)
private

Specific procedure of optval.

Variable Documentation

◆ optignored

logical, dimension(:), allocatable, public, protected ftn_getopt::optignored

Unprocessed options.

This variable is available after the first call to optarg.

◆ stat_alloc_fail

integer, parameter ftn_getopt::stat_alloc_fail = 1
private

private

◆ stat_arg_fail

integer, parameter ftn_getopt::stat_arg_fail = 4
private

private

◆ stat_option_undef

integer, parameter ftn_getopt::stat_option_undef = 5
private

private

◆ stat_success

integer, parameter ftn_getopt::stat_success = 0
private

private

◆ stat_type_mismatch

integer, parameter ftn_getopt::stat_type_mismatch = 3
private

private

◆ stat_type_unsupp

integer, parameter ftn_getopt::stat_type_unsupp = 2
private

private