This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Document some more GNU extensions


The following documentation patch describes some more of the extensions
(to the published fortran standards) currently supported by gfortran.
Be warned that I'm not really a fortran programmer, so the terminology
below may be suspect.  However, a recent patch of mine to add another
extension commonly supported by commercial compilers stalled after the
comment that such extensions should really be documented somewhere.
These modifications below are my practice attempt at documenting some
of gfortran's existing extensions in the "Extensions" section of the
gfortran.texi user documentation.

The following changes were tested on i686-pc-linux-gnu with both
a "make dvi" and a "make info", and then visually inspected via
dvips.  Comments on better wording or code examples gladly welcomed.

Ok for mainline?  After the unslush?



2005-05-22  Roger Sayle  <roger@eyesopen.com>

	* gfortran.texi: Document some more GNU extensions.


Index: gfortran.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/gfortran.texi,v
retrieving revision 1.12
diff -c -3 -p -r1.12 gfortran.texi
*** gfortran.texi	23 Apr 2005 17:03:07 -0000	1.12
--- gfortran.texi	22 May 2005 22:56:26 -0000
*************** meaning.
*** 624,629 ****
--- 624,635 ----
  * Old-style kind specifications::
  * Old-style variable initialization::
  * Extensions to namelist::
+ * X format descriptor::
+ * Commas in FORMAT specifications::
+ * I/O item lists::
+ * Hexadecimal constants::
+ * Real array indices::
+ * Unary operators::
  @end menu

  @node Old-style kind specifications
*************** had been called:
*** 720,725 ****
--- 726,791 ----
  To aid this dialog, when input is from stdin, errors produce send their
  messages to stderr and execution continues, even if IOSTAT is set.

+ @node X format descriptor
+ @section X format descriptor
+ @cindex X format descriptor
+
+ To support legacy codes, @command{gfortran} permits the count field
+ of the X edit descriptor in FORMAT statements to be ommitted.  When
+ ommitted, the count is implicitly assumed to be one.
+
+ @smallexample
+        PRINT 10, 2, 3
+ 10     FORMAT (I1, X, I1)
+ @end smallexample
+
+ @node Commas in FORMAT specifications
+ @section Commas in FORMAT specifications
+ @cindex Commas in FORMAT specifications
+
+ To support legacy codes, @command{gfortran} allows the comma separator
+ to be ommitted immediately before and after character string edit
+ descriptors in FORMAT statements.
+
+ @smallexample
+        PRINT 10, 2, 3
+ 10     FORMAT ('FOO='I1' BAR='I2)
+ @end smallexample
+
+ @node I/O item lists
+ @section I/O item lists
+ @cindex I/O item lists
+
+ To support legacy codes, @command{gfortran} allows the input item list
+ of the READ statement, and the output item lists of the WRITE and PRINT
+ statements to start with a comma.
+
+ @node Hexadecimal constants
+ @section Hexadecimal constants
+ @cindex Hexadecimal constants
+
+ As a GNU extension, @command{gfortran} allows hexadecimal constants to
+ be specified using the X prefix, in addition to the standard Z prefix.
+
+ @node Real array indices
+ @section Real array indices
+ @cindex Real array indices
+
+ As a GNU extension, @command{gfortran} allows arrays to be indexed using
+ real types, whose values are implicitly converted to integers.
+
+ @node Unary operators
+ @section Unary operators
+ @cindex Unary operators
+
+ As a GNU extension, @command{gfortran} allows unary plus and unary
+ minus operators to appear as the second operand of binary arithmetic
+ operators without the need for parenthesis.
+
+ @smallexample
+        X = Y * -Z
+ @end smallexample
+
  @include intrinsic.texi
  @c ---------------------------------------------------------------------
  @c Contributing


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]