Manual Reference Pages  - get_args_fixed_size (3m_cli2)

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)

    character(len=*),intent(in) :: name
    [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


Nemo Release 3.1 get_args_fixed_size (3m_cli2) August 01, 2024
Generated by manServer 1.08 from 5ebf8a78-e486-4b34-98a6-019f9c781843 using man macros.