File: demo_get_args_fixed_size.f90

package info (click to toggle)
fortran-cli2 3.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,856 kB
  • sloc: f90: 6,172; javascript: 3,423; makefile: 189; sh: 25
file content (38 lines) | stat: -rwxr-xr-x 1,331 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
      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