get_args_fixed_size(3m_cli2)

πŸ“¦ version 3.2.0, in ubuntu resolute, ubuntu stonking

✨ get_args_fixed_size ✨

okay bestie, gather round, because this one lives in the 3m_cli2 manual and it is lowkey the moment your fixed-size arrays get their values handed to them πŸ’…

πŸ’– NAME πŸ’–

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

like, that's the whole job. that's the assignment. and she ate. πŸ“


🌸 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

no cap, that's the shape of it πŸ¦‹


πŸŽ€ DESCRIPTION πŸŽ€

so get_args_fixed_size(3f) returns the value of keywords for fixed-size arrays, and it does this after set_args(3f) has already been called. think of set_args as the one who set the whole thing up and this one as the one who shows up to collect.

and here's the tea: on input on the command line, all values of the array must be specified. every single one. no skipping, no leaving a spot empty, periodt πŸ‘‘


✨ OPTIONS ✨

  • NAME β€” the name of the commandline argument you want to obtain the value of. just the name, bestie.
  • VALUE β€” the variable that holds the returned values. the kind of the value is what determines the type of the returned value. it must be a fixed-size array. and if the type is CHARACTER, then the length must be fixed too. fixed fixed fixed, she said what she said πŸ’…
  • DELIMITERS β€” by default the delimiter for array values are comma, colon, and whitespace. but you can supply a string containing an alternate list of delimiter characters if the default vibe isn't your vibe 🌈

🌟 EXAMPLE 🌟

sample program, bestie, here she is in all her glory:

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:

not me leaving this blank because the source leaves it blank πŸ™ˆ the example runs, the vibes are immaculate, and the results section is just… existing. iconic behaviour honestly πŸ’€

πŸ’œ AUTHOR πŸ’œ

John S. Urban, 2019 πŸ‘‘


🫢 LICENSE 🫢

Public Domain β€” free as a butterfly, do whatever, no strings πŸ¦‹


and that's the whole page, bestie! this beauty was dated February 10, 2023 and she lives in the get_args_fixed_size(3m_cli2) manual, so if you ever forget where you found her, that's the return address πŸ’Œ stay parsing, stay slaying, fr fr 🌈✨

πŸ“¦ where this page comes from