[UP]


Manual Reference Pages  - get_args_fixed_size (3)

NAME

get_args_fixed_size(3f) - [ARGUMENTS:M_CLI2] return keyword values for fixed-size array when parsing command line arguments (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Example
Author
License

SYNOPSIS

subroutine get_args_fixed_size(name,value)

    [real|doubleprecision|integer|logical|complex] :: value(NNN)
       or
    character(len=MMM) :: value(NNN)

character(len=*),intent(in),optional :: delimiters

DESCRIPTION

GET_ARGS_FIXED_SIZE(3f) returns the value of keywords for fixed-size arrays after SET_ARGS(3f) has been called. On input on the command line all values of the array must be specified.

OPTIONS

NAME name of commandline argument to obtain the value of
VALUE variable to hold returned values. The kind of the value is used to determine the type of returned value. Must be a fixed-size array. If type is CHARACTER the length must also be fixed.
DELIMITERS
  By default the delimiter for array values are comma, colon, and whitespace. A string containing an alternate list of delimiter characters may be supplied.

EXAMPLE

Sample program:

    program demo_get_args_fixed_size
    use M_CLI2,  only : set_args, get_args_fixed_size
    implicit none
    integer,parameter   :: dp=kind(0.0d0)
    ! DEFINE ARGS
    real                :: x(2)
    real(kind=dp)       :: y(2)
    integer             :: p(3)
    character(len=80)   :: title(1)
    logical             :: l(4), lbig(4)
    complex             :: cmp(2)
    ! DEFINE AND PARSE (TO SET INITIAL VALUES) COMMAND LINE
    !   o only quote strings
    !   o set all logical values to F or T.
    call set_args(’ &
       & -x 10.0,20.0 &
       & -y 11.0,22.0 &
       & -p -1,-2,-3 &
       & -title "my title" &
       & -l F,T,F,T -L T,F,T,F  &
       & --cmp 111,222.0,333.0e0,4444 &
       & ’)
    ! ASSIGN VALUES TO ELEMENTS
       call get_args_fixed_size(’x’,x)
       call get_args_fixed_size(’y’,y)
       call get_args_fixed_size(’p’,p)
       call get_args_fixed_size(’title’,title)
       call get_args_fixed_size(’l’,l)
       call get_args_fixed_size(’L’,lbig)
       call get_args_fixed_size(’cmp’,cmp)
    ! USE VALUES
       write(*,*)’x=’,x
       write(*,*)’p=’,p
       write(*,*)’title=’,title
       write(*,*)’l=’,l
       write(*,*)’L=’,lbig
       write(*,*)’cmp=’,cmp
    end program demo_get_args_fixed_size
Results:

AUTHOR

John S. Urban, 2019

LICENSE

Public Domain


get_args_fixed_size (3) March 11, 2021
Generated by manServer 1.08 from 8379032a-07e9-4b26-9c0b-75c7e50456c9 using man macros.