Sophie

Sophie

distrib > Mandriva > 2011.0 > x86_64 > by-pkgid > f13f137693327172bf7ba9b443ff3a61 > files > 117

gcc-gfortran-4.6.1-2.x86_64.rpm

<html lang="en">
<head>
<title>Extensions to namelist - The GNU Fortran Compiler</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU Fortran Compiler">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Extensions-implemented-in-GNU-Fortran.html#Extensions-implemented-in-GNU-Fortran" title="Extensions implemented in GNU Fortran">
<link rel="prev" href="Old_002dstyle-variable-initialization.html#Old_002dstyle-variable-initialization" title="Old-style variable initialization">
<link rel="next" href="X-format-descriptor-without-count-field.html#X-format-descriptor-without-count-field" title="X format descriptor without count field">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
``GNU Free Documentation License''.

(a) The FSF's Front-Cover Text is:

     A GNU Manual

(b) The FSF's Back-Cover Text is:

     You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Extensions-to-namelist"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="X-format-descriptor-without-count-field.html#X-format-descriptor-without-count-field">X format descriptor without count field</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Old_002dstyle-variable-initialization.html#Old_002dstyle-variable-initialization">Old-style variable initialization</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Extensions-implemented-in-GNU-Fortran.html#Extensions-implemented-in-GNU-Fortran">Extensions implemented in GNU Fortran</a>
<hr>
</div>

<h4 class="subsection">6.1.3 Extensions to namelist</h4>

<p><a name="index-Namelist-308"></a>
GNU Fortran fully supports the Fortran 95 standard for namelist I/O
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:

   <p>Old-style use of &lsquo;<samp><span class="samp">$</span></samp>&rsquo; instead of &lsquo;<samp><span class="samp">&amp;</span></samp>&rsquo;
<pre class="smallexample">     $MYNML
      X(:)%Y(2) = 1.0 2.0 3.0
      CH(1:4) = "abcd"
     $END
</pre>
   <p>It should be noted that the default terminator is &lsquo;<samp><span class="samp">/</span></samp>&rsquo; rather than
&lsquo;<samp><span class="samp">&amp;END</span></samp>&rsquo;.

   <p>Querying of the namelist when inputting from stdin.  After at least
one space, entering &lsquo;<samp><span class="samp">?</span></samp>&rsquo; sends to stdout the namelist name and the names of
the variables in the namelist:
<pre class="smallexample">      ?
     
     &amp;mynml
      x
      x%y
      ch
     &amp;end
</pre>
   <p>Entering &lsquo;<samp><span class="samp">=?</span></samp>&rsquo; outputs the namelist to stdout, as if
<code>WRITE(*,NML = mynml)</code> had been called:
<pre class="smallexample">     =?
     
     &amp;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,  /
</pre>
   <p>To aid this dialog, when input is from stdin, errors send their
messages to stderr and execution continues, even if <code>IOSTAT</code> is set.

   <p><code>PRINT</code> namelist is permitted.  This causes an error if
<samp><span class="option">-std=f95</span></samp> is used.
<pre class="smallexample">     PROGRAM test_print
       REAL, dimension (4)  ::  x = (/1.0, 2.0, 3.0, 4.0/)
       NAMELIST /mynml/ x
       PRINT mynml
     END PROGRAM test_print
</pre>
   <p>Expanded namelist reads are permitted.  This causes an error if
<samp><span class="option">-std=f95</span></samp> is used.  In the following example, the first element
of the array will be given the value 0.00 and the two succeeding
elements will be given the values 1.00 and 2.00.
<pre class="smallexample">     &amp;MYNML
       X(1,1) = 0.00 , 1.00 , 2.00
     /
</pre>
   </body></html>