Module ppm_module_ctrl

This module provides an easy way to handle command line arguments and control files.

Intended Usage. This module assumes that you will create a module that contains all your global variables (which we will call client_global) and gives you an easy way of supplying values for these variables, either through command line arguments or control files.

To do this, you have to create a subroutine (which we will call define_args) that will hold the initialization code. See the following example.

MODULE client_global
  USE ppm_module_ctrl
  INTEGER :: example
CONTAINS
  SUBROUTINE define_args
     CALL arg(exampe, 'example',     &
              flag      = '-e',      &
              ctrl_name = 'example')
  END SUBROUTINE define_args
END MODULE client_global

This will create an argument of type integer that can be set either through the command line flag '-e' or the control file variable 'example'. Please take note that the command line flag will override the setting in the control file if both are supplied.

For this code to work you need to call define_args somewhere in your initialization code, followed by a call parse_args(info). After parse_args completes your globals will be initialized with the supplied values.

The function arg is overloaded to support integer, real, character, logical and complex arguments or fixed sized arrays of these types. The first two arguments are required and they are: the variable itself (to which a pointer will be stored) and the name of the variable (used for printing help messages).

All other arguments are optional and the details of how they work can be found below. Here is just a short overview and reference of the available options:

flag

['-f'] single character command line flag

long_flag

['--long-flag'] long command line flag (starts with --)

ctrl_name

['name'] name of the control file varible

default

[42] default value

min

[4] minimum value for numeric types

max

[30] maximum value

help

[Description.] help message to display in the auto generated ctrl file and command line help. You can use \n to force a line break.

default_func

[external_func] custom function to compute the value of the variable after other globals have been set (only available when compiled with F2003 support)

validator

[external_func] custom function to validate the variable value (only available when compiled with F2003 support)

By default the module supports -h and --help flags for printing the help message, and --print-ctrl for printing a sample control file. There is also an optional first positional argument that is interpreted as the name of the control file.

To make the output prettier you can add calls to arg_group('name') to your define_args and all calls to arg following a group definition will be put into that group.

If any one of the printing flags is present parse_args will return exit_gracefully which you should check for and exit gracefully.

Defined Types

Defined Module Interfaces

name description

arg

Defined Module Subroutines

name description

add_cmd

Debugging and testing procedure. First call replaces the actual

apply_defaults

arg_count

Returns the number of positional arguments found.

arg_group

Defines an argument group.

break_help

check_minmax

deallocate_memory

disable_ctrl

Turns of control file parsing.

disable_help

Turns of help flag parsing.

dump_args

Debugging procedure. Prints all supplied command line args.

find_arg

Returns a positional argument at position.

find_flag

Returns the value supplied with the flag flag.

parse_args

parse_cmd_line

parse_ctrl_file

print_ctrl

Prints a sample control file to standard output.

print_help

Prints usage information to the standard output.

read_cmd_args

reset

Debugging and testing routine. Resets all module variables.

set_ctrl_name

Sets the control file name.

uppercase

Type complex_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

complex

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

complex

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

complex,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

complex,

Type complex_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

complex array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

complex array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

complex array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

complex array, (:)

Type dcomplex_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

complex

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

complex

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

complex,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

complex,

Type dcomplex_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

complex array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

complex array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

complex array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

complex array, (:)

Type double_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

real

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

real

max_set

logical

min

real

min_set

logical

name

character

settable

logical

variable

real

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

real,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

real,

max_set

logical,

min

real,

min_set

logical,

name

character,

settable

logical,

variable

real,

Type double_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

real array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

real

max_set

logical

min

real

min_set

logical

name

character

settable

logical

variable

real array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

real array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

real,

max_set

logical,

min

real,

min_set

logical,

name

character,

settable

logical,

variable

real array, (:)

Type integer_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

integer

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

integer

max_set

logical

min

integer

min_set

logical

name

character

settable

logical

variable

integer

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

integer,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

integer,

max_set

logical,

min

integer,

min_set

logical,

name

character,

settable

logical,

variable

integer,

Type integer_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

integer array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

integer

max_set

logical

min

integer

min_set

logical

name

character

settable

logical

variable

integer array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

integer array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

integer,

max_set

logical,

min

integer,

min_set

logical,

name

character,

settable

logical,

variable

integer array, (:)

Type logical_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

logical

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

type

logical

variable

logical

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

logical,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

type

logical,

variable

logical,

Type logical_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

logical array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

logical array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

logical array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

logical array, (:)

Type longint_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

integer

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

integer

max_set

logical

min

integer

min_set

logical

name

character

settable

logical

variable

integer

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

integer,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

integer,

max_set

logical,

min

integer,

min_set

logical,

name

character,

settable

logical,

variable

integer,

Type longint_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

integer array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

integer

max_set

logical

min

integer

min_set

logical

name

character

settable

logical

variable

integer array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

integer array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

integer,

max_set

logical,

min

integer,

min_set

logical,

name

character,

settable

logical,

variable

integer array, (:)

Type single_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

real

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

real

max_set

logical

min

real

min_set

logical

name

character

settable

logical

variable

real

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

real,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

real,

max_set

logical,

min

real,

min_set

logical,

name

character,

settable

logical,

variable

real,

Type single_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

real array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max

real

max_set

logical

min

real

min_set

logical

name

character

settable

logical

variable

real array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

real array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max

real,

max_set

logical,

min

real,

min_set

logical,

name

character,

settable

logical,

variable

real array, (:)

Type string_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

character

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

character

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

character,

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

character,

Type string_array_arg

Defined Type Members

name type dimension description

clf_supplied

logical

ctrl_name

character

ctrl_name_set

logical

default

character array

(:)

default_set

logical

flag

character

flag_set

logical

group

integer

group_i

integer

help

character

help_set

logical

long_flag

character

long_flag_set

logical

max_set

logical

min_set

logical

name

character

settable

logical

variable

character array

(:)

clf_supplied

logical,

ctrl_name

character,

ctrl_name_set

logical,

default

character array, (:)

default_set

logical,

flag

character,

flag_set

logical,

group

integer,

group_i

integer,

help

character,

help_set

logical,

long_flag

character,

long_flag_set

logical,

max_set

logical,

min_set

logical,

name

character,

settable

logical,

variable

character array, (:)

Interface arg

Subroutines contained in this interface:

name description

integer_add_arg

Adds a new arg definition.

longint_add_arg

Adds a new arg definition.

single_add_arg

Adds a new arg definition.

double_add_arg

Adds a new arg definition.

logical_add_arg

Adds a new arg definition.

string_add_arg

Adds a new arg definition.

complex_add_arg

Adds a new arg definition.

dcomplex_add_arg

Adds a new arg definition.

integer_array_add_arg

Adds a new arg definition.

longint_array_add_arg

Adds a new arg definition.

single_array_add_arg

Adds a new arg definition.

double_array_add_arg

Adds a new arg definition.

logical_array_add_arg

Adds a new arg definition.

string_array_add_arg

Adds a new arg definition.

complex_array_add_arg

Adds a new arg definition.

dcomplex_array_add_arg

Adds a new arg definition.

Subroutine add_cmd

Debugging and testing procedure. First call replaces the actual command arguments with the supplied values. Can be called many times to incrementally build the fake argument list.

Arguments

name type dimension intent optional description

arg

character

(IN)

Argument string to be appended to the list.

value

character

(IN)

X

Optional value to append.

arg

character, , (IN)

Argument string to be appended to the list.

(Optional) value

character, , (IN)

Optional value to append.

Used Modules

has no uses

Subroutine apply_defaults

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine arg_count

Returns the number of positional arguments found.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine arg_group

Defines an argument group.

Arguments

name type dimension intent optional description

name

character

(IN)

Group name

name

character, , (IN)

Group name

Used Modules

has no uses

Subroutine break_help

Arguments

name type dimension intent optional description

ht

character

(IN)

w

integer

(IN)

prefix

character

(IN)

unit

integer

(IN)

skip_first_line

logical

(IN)

X

ht

character, , (IN)

w

integer, , (IN)

prefix

character, , (IN)

unit

integer, , (IN)

(Optional) skip_first_line

logical, , (IN)

Used Modules

has no uses

Subroutine check_minmax

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine complex_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

complex

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

complex

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

complex, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

complex, , (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine complex_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

complex array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

complex array

(:)

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

complex array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

complex array, (:), (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine dcomplex_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

complex

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

complex

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

complex, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

complex, , (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine dcomplex_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

complex array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

complex array

(:)

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

complex array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

complex array, (:), (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine deallocate_memory

Arguments

name type dimension intent optional description

all

logical

(IN)

all

logical, , (IN)

Used Modules

has no uses

Subroutine disable_ctrl

Turns of control file parsing.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine disable_help

Turns of help flag parsing.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine double_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

real

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

real

(IN)

X

Default value.

min

real

(IN)

X

Minimum value of arg.

max

real

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

real, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

real, , (IN)

Default value.

(Optional) min

real, , (IN)

Minimum value of arg.

(Optional) max

real, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine double_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

real array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

real array

(:)

(IN)

X

Default value.

min

real

(IN)

X

Minimum value of arg.

max

real

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

real array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

real array, (:), (IN)

Default value.

(Optional) min

real, , (IN)

Minimum value of arg.

(Optional) max

real, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine dump_args

Debugging procedure. Prints all supplied command line args.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine find_arg

Returns a positional argument at position.

Arguments

name type dimension intent optional description

position

integer

(IN)

Index of the positional argument, 1 based.

success

logical

(OUT)

True on success. False if there is no positional arg with the

value

character

(INOUT)

The value of the positional argument (character string).

position

integer, , (IN)

Index of the positional argument, 1 based.

success

logical, , (OUT)

True on success. False if there is no positional arg with the supplied index.

value

character, , (INOUT)

The value of the positional argument (character string).

Used Modules

has no uses

Subroutine find_flag

Returns the value supplied with the flag flag.

Arguments

name type dimension intent optional description

flag

character

(IN)

Flag string (eg. '-f' or '--flag').

success

logical

(OUT)

True on success. False if there is no such flag or the value is

value

character

(OUT)

The value of supplied for the flag (character string).

err

logical

(OUT)

Returns .TRUE. if the flag was supplied without a value.

flag

character, , (IN)

Flag string (eg. '-f' or '--flag').

success

logical, , (OUT)

True on success. False if there is no such flag or the value is not supplied.

value

character, , (OUT)

The value of supplied for the flag (character string).

err

logical, , (OUT)

Returns .TRUE. if the flag was supplied without a value.

Used Modules

has no uses

Subroutine integer_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

integer

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

integer

(IN)

X

Default value.

min

integer

(IN)

X

Minimum value of arg.

max

integer

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

integer, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

integer, , (IN)

Default value.

(Optional) min

integer, , (IN)

Minimum value of arg.

(Optional) max

integer, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine integer_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

integer array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

integer array

(:)

(IN)

X

Default value.

min

integer

(IN)

X

Minimum value of arg.

max

integer

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

integer array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

integer array, (:), (IN)

Default value.

(Optional) min

integer, , (IN)

Minimum value of arg.

(Optional) max

integer, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine logical_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

logical

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

logical

(IN)

X

Default value.

type

logical

(IN)

X

Type of flag. Logical flags require no value to be supplied.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

logical, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

logical, , (IN)

Default value.

(Optional) type

logical, , (IN)

Type of flag. Logical flags require no value to be supplied. Instead the behavior depends on this argument. One of: enabling_flag :: Presence of flag sets variable to .TRUE. disabling_flag :: Presence of flag sets variable to .FALSE.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine logical_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

logical array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

logical array

(:)

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

logical array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

logical array, (:), (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine longint_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

integer

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

integer

(IN)

X

Default value.

min

integer

(IN)

X

Minimum value of arg.

max

integer

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

integer, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

integer, , (IN)

Default value.

(Optional) min

integer, , (IN)

Minimum value of arg.

(Optional) max

integer, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine longint_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

integer array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

integer array

(:)

(IN)

X

Default value.

min

integer

(IN)

X

Minimum value of arg.

max

integer

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

integer array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

integer array, (:), (IN)

Default value.

(Optional) min

integer, , (IN)

Minimum value of arg.

(Optional) max

integer, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine parse_args

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine parse_cmd_line

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine parse_ctrl_file

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine print_ctrl

Prints a sample control file to standard output.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine print_help

Prints usage information to the standard output.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine read_cmd_args

Arguments

name type dimension intent optional description

info

integer

(OUT)

info

integer, , (OUT)

Used Modules

has no uses

Subroutine reset

Debugging and testing routine. Resets all module variables.

Arguments

name type dimension intent optional description

no variables

Used Modules

has no uses

Subroutine set_ctrl_name

Sets the control file name.

Arguments

name type dimension intent optional description

name

character

(IN)

Name of the control file.

name

character, , (IN)

Name of the control file.

Used Modules

has no uses

Subroutine single_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

real

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

real

(IN)

X

Default value.

min

real

(IN)

X

Minimum value of arg.

max

real

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

real, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

real, , (IN)

Default value.

(Optional) min

real, , (IN)

Minimum value of arg.

(Optional) max

real, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine single_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

real array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

real array

(:)

(IN)

X

Default value.

min

real

(IN)

X

Minimum value of arg.

max

real

(IN)

X

Maximum value of arg.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

real array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

real array, (:), (IN)

Default value.

(Optional) min

real, , (IN)

Minimum value of arg.

(Optional) max

real, , (IN)

Maximum value of arg.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine string_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

character

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

character

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

character, , (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

character, , (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine string_array_add_arg

Adds a new arg definition.

Arguments

name type dimension intent optional description

variable

character array

(:)

(IN)

Global variable to bind to.

name

character

(IN)

Name of the arg for use in the auto generated usage message/ctrl file.

flag

character

(IN)

X

Single character flag (eg. '-f').

long_flag

character

(IN)

X

Long flag (eg. '--flag'). Has to start with '--'!

ctrl_name

character

(IN)

X

Control file variable name.

default

character array

(:)

(IN)

X

Default value.

help

character

(IN)

X

Help string for the auto generated usage message/ctrl file.

variable

character array, (:), (IN)

Global variable to bind to.

name

character, , (IN)

Name of the arg for use in the auto generated usage message/ctrl file.

(Optional) flag

character, , (IN)

Single character flag (eg. '-f').

(Optional) long_flag

character, , (IN)

Long flag (eg. '--flag'). Has to start with '--'!

(Optional) ctrl_name

character, , (IN)

Control file variable name.

(Optional) default

character array, (:), (IN)

Default value.

(Optional) help

character, , (IN)

Help string for the auto generated usage message/ctrl file.

Used Modules

has no uses

Subroutine uppercase

Arguments

name type dimension intent optional description

string

character

(INOUT)

ilen

integer

(IN)

info

integer

(OUT)

string

character, , (INOUT)

ilen

integer, , (IN)

info

integer, , (OUT)

Used Modules

has no uses

Defined Module Variables

name type dimension description

ctrl_file_test

character

disabling_flag

logical

Value for type option of logical args. Presence of flag sets

enabling_flag

logical

Value for type option of logical args. Presence of flag sets

exit_gracefully

integer

Value of the info argument of parse_args that signals that

ctrl_file_test

character,

disabling_flag

logical,

Value for type option of logical args. Presence of flag sets variable to .FALSE.

enabling_flag

logical,

Value for type option of logical args. Presence of flag sets variable to .TRUE.

exit_gracefully

integer,

Value of the info argument of parse_args that signals that the program should exit without error.

Used Modules

ppm_module_data, ppm_module_error, ppm_module_substart, ppm_module_typedef, ppm_module_substop