C Library Functions  - print_dictionary (3)

NAME

print_dictionary(3f) - [ARGUMENTS:M_namelist] print internal dictionary (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Examples
Author
License

SYNOPSIS

subroutine print_dictionary(header)

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

DESCRIPTION

Print the internal dictionary. This routine is intended to print the state of the argument list if an error occurs.

OPTIONS

HEADER label to print before printing the state of the command argument list.

EXAMPLES

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_dictionary

Sample output

Calling the sample program with an unknown parameter produces the following:

      $ ./print_dictionary -A
      UNKNOWN SHORT KEYWORD: -A

    KEYWORD PRESENT VALUE

z F [3]
y F [2]
x F [1]
help F [F]
h F [F]
STOP 2

AUTHOR

John S. Urban, 2019

LICENSE

CC0-1.0


Nemo Release 3.1 print_dictionary (3) June 29, 2025
Generated by manServer 1.08 from 49dfd74f-81b2-4322-8e3d-f6f78e1c5013 using man macros.