print_dictionary(3f) - [ARGUMENTS:M_namelist] print internal dictionary (LICENSE:PD)
Synopsis
Description
Options
Examples
Author
License
subroutine print_dictionary(header)
character(len=*),intent(in),optional :: header
Print the internal dictionary. This routine is intended to print the state of the argument list if an error occurs.
HEADER label to print before printing the state of the command argument list.
Typical usage:
program demo_print_dictionary use M_namelist, only : unnamed, print_dictionary implicit none integer :: i character(len=255) :: message ! use for I/O error messages character(len=:),allocatable :: readme ! stores updated namelist integer :: ios real :: x, y, z logical :: help, h equivalence (help,h) namelist /args/ x,y,z,help,h character(len=*),parameter :: cmd=&ARGS X=1 Y=2 Z=3 HELP=F H=F / ! initialize namelist from string and then update from command line readme=cmd read(readme,nml=args,iostat=ios,iomsg=message) if(ios.ne.0)then write(*,("ERROR:",i0,1x,a))ios, trim(message) call print_dictionary(OPTIONS:) stop 1 endif ! all done cracking the command line ! use the values in your program. write(*,nml=args) ! the optional unnamed values on the command line are ! accumulated in the character array "UNNAMED" if(allocated(unnamed))then if(size(unnamed).gt.0)then write(*,(a))files: write(*,(i6.6,3a))(i,[,unnamed(i),],i=1,size(unnamed)) endif endif end program demo_print_dictionarySample output
Calling the sample program with an unknown parameter produces the following:
$ ./print_dictionary -A UNKNOWN SHORT KEYWORD: -A
STOP 2
z F [3] y F [2] x F [1] help F [F] h F [F]
John S. Urban, 2019
CC0-1.0
Nemo Release 3.1 | print_dictionary (3) | June 29, 2025 |