Previous: Old-style variable initialization, Up: Extensions


6.3 Extensions to namelist

gfortran fully supports the fortran95 standard for namelist io including array qualifiers, substrings and fully qualified derived types. The output from a namelist write is compatible with namelist read. The output has all names in upper case and indentation to column 1 after the namelist name. Two extensions are permitted:

Old-style use of $ instead of &

     $MYNML
      X(:)%Y(2) = 1.0 2.0 3.0
      CH(1:4) = "abcd"
     $END

It should be noticed that the default terminator is / rather than &END.

Querying of the namelist when inputting from stdin. After at least one space, entering ? sends to stdout the namelist name and the names of the variables in the namelist:

     ?
     
     &mynml
      x
      x%y
      ch
     &end

Entering =? outputs the namelist to stdout, as if WRITE (*,NML = mynml) had been called:

     =?
     
     &MYNML
      X(1)%Y=  0.000000    ,  1.000000    ,  0.000000    ,
      X(2)%Y=  0.000000    ,  2.000000    ,  0.000000    ,
      X(3)%Y=  0.000000    ,  3.000000    ,  0.000000    ,
      CH=abcd,  /

To aid this dialog, when input is from stdin, errors produce send their messages to stderr and execution continues, even if IOSTAT is set.