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]

[documentation, fortran] more intrinsics


I found three more intrinsic procedures that where immplemented but not yet 
documented.


2007-03-08  Daniel Franke  <franke.daniel@gmail.com>

	* intrinsic.texi (GERROR, ISATTY, TTYNAM): New.
	(ABORT, FLUSH, FNUM, IRAND, MALLOC, SIGNAL, SRAND): Fixed typo.
	* intrinsic.c (add_subroutines): Changed dummy argument name
	of gerror from count to result.


Tested info, dvi and html targets on x86-pc-linux-gnu.

Ok for trunk and possibly for 4.2?

Regards
	Daniel
Index: intrinsic.texi
===================================================================
--- intrinsic.texi	(revision 122640)
+++ intrinsic.texi	(working copy)
@@ -125,6 +125,7 @@
 * @code{FSEEK}:         FSEEK,     Low level file positioning subroutine
 * @code{FSTAT}:         FSTAT,     Get file status
 * @code{FTELL}:         FTELL,     Current stream position
+* @code{GERROR}:        GERROR,    Get last system error message
 * @code{GETARG}:        GETARG,    Get command line arguments
 * @code{GET_COMMAND}:   GET_COMMAND, Get the entire command line
 * @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
@@ -152,6 +153,7 @@
 * @code{INT}:           INT,       Convert to integer type
 * @code{IOR}:           IOR,       Bitwise logical or
 * @code{IRAND}:         IRAND,     Integer pseudo-random number
+* @code{ISATTY}:        ISATTY,    Whether a unit is a terminal device
 * @code{ISHFT}:         ISHFT,     Shift bits
 * @code{ISHFTC}:        ISHFTC,    Shift bits circularly
 * @code{ITIME}:         ITIME,     Current local time (hour/minutes/seconds)
@@ -244,6 +246,7 @@
 * @code{TRANSFER}:      TRANSFER,  Transfer bit patterns
 * @code{TRANSPOSE}:     TRANSPOSE, Transpose an array of rank two
 * @code{TRIM}:          TRIM,      Function to remove trailing blank characters of a string
+* @code{TTYNAM}:        TTYNAM,    Get the name of a terminal device.
 * @code{UBOUND}:        UBOUND,    Upper dimension bounds of an array
 * @code{UMASK}:         UMASK,     Set the file creation mask
 * @code{UNLINK}:        UNLINK,    Remove a file from the file system
@@ -308,7 +311,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental subroutine
+Non-elemental subroutine
 
 @item @emph{Syntax}:
 @code{CALL ABORT}
@@ -3612,7 +3619,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental subroutine
+Non-elemental subroutine
 
 @item @emph{Syntax}:
 @code{CALL FLUSH(UNIT)}
@@ -3644,7 +3651,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental function
+Non-elemental function
 
 @item @emph{Syntax}:
 @code{RESULT = FNUM(UNIT)}
@@ -3973,6 +3980,44 @@
 
 
 
+@node GERROR
+@section @code{GERROR} --- Get last system error message
+@cindex @code{GERROR} intrinsic
+
+@table @asis
+@item @emph{Description}:
+Returns the system error message corresponding to the last system error.
+This resembles the functionality of @code{strerror(3)} in C.
+
+@item @emph{Standard}:
+GNU extension
+
+@item @emph{Class}:
+Subroutine
+
+@item @emph{Syntax}:
+@code{CALL GERROR(RESULT)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{RESULT}  @tab Shall of type @code{CHARACTER(*)}.
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+PROGRAM test_gerror
+  CHARACTER(len=100) :: msg
+  CALL gerror(msg)
+  WRITE(*,*) msg
+END PROGRAM
+@end smallexample
+
+@item @emph{See also}:
+@ref{IERRNO}, @ref{PERROR}
+@end table
+
+
+
 @node GETARG
 @section @code{GETARG} --- Get command line arguments
 @cindex @code{GETARG} intrinsic
@@ -5118,7 +5163,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental function
+Non-elemental function
 
 @item @emph{Syntax}:
 @code{RESULT = IRAND(FLAG)}
@@ -5146,6 +5191,48 @@
 
 
 
+@node ISATTY
+@section @code{ISATTY} --- Whether a unit is a terminal device.
+@cindex @code{ISATTY} intrinsic
+
+@table @asis
+@item @emph{Description}:
+Determine whether a unit is connected to a terminal device.
+
+@item @emph{Standard}:
+GNU extension.
+
+@item @emph{Class}:
+Non-elemental function.
+
+@item @emph{Syntax}:
+@code{RESULT = ISATTY(UNIT)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{UNIT} @tab shall be a scalar @code{INTEGER(*)}.
+@end multitable
+
+@item @emph{Return value}:
+Returns @code{.TRUE.} if the @var{UNIT} is connected to a terminal 
+device, @code{.FALSE.} otherwise.
+
+@item @emph{Example}:
+@smallexample
+PROGRAM test_isatty
+  INTEGER(kind=1) :: unit
+  DO unit = 1, 10
+    write(*,*) isatty(unit=unit)
+  END DO
+END PROGRAM
+@end smallexample
+@item @emph{See also}:
+@ref{TTYNAM}
+@end table
+
+
+
+
 @node ISHFT
 @section @code{ISHFT} --- Shift bits
 @cindex @code{ISHFT} intrinsic
@@ -6041,7 +6128,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental function
+Non-elemental function
 
 @item @emph{Syntax}:
 @code{PTR = MALLOC(SIZE)}
@@ -7945,7 +8032,7 @@
 GNU extension
 
 @item @emph{Class}:
-subroutine, non-elemental function
+Subroutine, non-elemental function
 
 @item @emph{Syntax}:
 @multitable @columnfractions .80
@@ -8291,7 +8378,7 @@
 GNU extension
 
 @item @emph{Class}:
-non-elemental subroutine
+Non-elemental subroutine
 
 @item @emph{Syntax}:
 @code{CALL SRAND(SEED)}
@@ -8805,6 +8892,49 @@
 
 
 
+@node TTYNAM
+@section @code{TTYNAM} --- Get the name of a terminal device.
+@cindex @code{TTYNAM} intrinsic
+
+@table @asis
+@item @emph{Description}:
+Get the name of a terminal device. For more information, 
+see @code{ttyname(3)}.
+
+@item @emph{Standard}:
+GNU extension
+
+@item @emph{Class}:
+Subroutine
+
+@item @emph{Syntax}:
+@multitable @columnfractions .80
+@item @code{CALL TTYNAM(UNIT, NAME)}
+@item @code{NAME = TTYNAM(UNIT)}
+@end multitable
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{UNIT} @tab shall be a scalar @code{INTEGER(*)}.
+@item @var{NAME} @tab Shall be of type @code{CHARACTER(*)}.
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+PROGRAM test_ttynam
+  INTEGER :: unit
+  DO unit = 1, 10
+    IF (isatty(unit=unit)) write(*,*) ttynam(unit=unit)
+  END DO
+END PROGRAM
+@end smallexample
+
+@item @emph{See also}:
+@ref{ISATTY}
+@end table
+
+
+
 @node UBOUND
 @section @code{UBOUND} --- Upper dimension bounds of an array
 @cindex @code{UBOUND} intrinsic
Index: intrinsic.c
===================================================================
--- intrinsic.c	(revision 122639)
+++ intrinsic.c	(working copy)
@@ -2383,7 +2383,7 @@
 	      dt, BT_CHARACTER, dc, REQUIRED);
 
   add_sym_1s ("gerror", 0, BT_UNKNOWN, 0, GFC_STD_GNU,
-	      gfc_check_gerror, NULL, gfc_resolve_gerror, c, BT_CHARACTER,
+	      gfc_check_gerror, NULL, gfc_resolve_gerror, res, BT_CHARACTER,
 	      dc, REQUIRED);
 
   add_sym_2s ("getcwd", 0, BT_UNKNOWN, 0, GFC_STD_GNU,

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