OSDN Git Service

* intrinsic.texi: Various minor cleanups.
[pf3gnuchains/gcc-fork.git] / gcc / fortran / intrinsic.texi
index f775956..2e0194e 100644 (file)
@@ -44,11 +44,15 @@ and editing.  All contributions and corrections are strongly encouraged.
 Implemented intrinsics are fully functional and available to the user to apply. 
 Some intrinsics have documentation yet to be completed as indicated by 'documentation pending'.
 
+@comment Missing intrinsics (double check with #19292)
+@comment  - MClock
+@comment  - Short
+
 @menu
 * Introduction:         Introduction
 * @code{ABORT}:         ABORT,     Abort the program     
 * @code{ABS}:           ABS,       Absolute value     
-* @code{ACCESS}:        ACCESS,    Checks file access method
+* @code{ACCESS}:        ACCESS,    Checks file access modes
 * @code{ACHAR}:         ACHAR,     Character in @acronym{ASCII} collating sequence
 * @code{ACOS}:          ACOS,      Arccosine function
 * @code{ACOSH}:         ACOSH,     Hyperbolic arccosine function
@@ -81,7 +85,7 @@ Some intrinsics have documentation yet to be completed as indicated by 'document
 * @code{CHDIR}:         CHDIR,     Change working directory
 * @code{CHMOD}:         CHMOD,     Change access permissions of files
 * @code{CMPLX}:         CMPLX,     Complex conversion function
-* @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT,  Command line argument count
+* @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
 * @code{CONJG}:         CONJG,     Complex conjugate function
 * @code{COS}:           COS,       Cosine function
 * @code{COSH}:          COSH,      Hyperbolic cosine function
@@ -122,8 +126,8 @@ Some intrinsics have documentation yet to be completed as indicated by 'document
 * @code{FSTAT}:         FSTAT,     Get file status
 * @code{FTELL}:         FTELL,     Current stream position
 * @code{GETARG}:        GETARG,    Get command line arguments
-* @code{GET_COMMAND}:   GET_COMMAND, Subroutine to retrieve the entire command line
-* @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Subroutine to retrieve a command argument
+* @code{GET_COMMAND}:   GET_COMMAND, Get the entire command line
+* @code{GET_COMMAND_ARGUMENT}: GET_COMMAND_ARGUMENT, Get command line arguments
 * @code{GETCWD}:        GETCWD,    Get current working directory
 * @code{GETENV}:        GETENV,    Get an environmental variable
 * @code{GET_ENVIRONMENT_VARIABLE}: GET_ENVIRONMENT_VARIABLE, Get an environmental variable
@@ -136,7 +140,7 @@ Some intrinsics have documentation yet to be completed as indicated by 'document
 * @code{HUGE}:          HUGE,      Largest number of a kind
 * @code{IACHAR}:        IACHAR,    Code in @acronym{ASCII} collating sequence
 * @code{IAND}:          IAND,      Bitwise logical and
-* @code{IARGC}:         IARGC,     Get number of command line arguments
+* @code{IARGC}:         IARGC,     Get the number of command line arguments
 * @code{IBCLR}:         IBCLR,     Clear bit
 * @code{IBITS}:         IBITS,     Bit extraction
 * @code{IBSET}:         IBSET,     Set bit
@@ -167,6 +171,7 @@ Some intrinsics have documentation yet to be completed as indicated by 'document
 * @code{LOG10}:         LOG10,     Base 10 logarithm function 
 * @code{LOGICAL}:       LOGICAL,   Convert to logical type
 * @code{LSHIFT}:        LSHIFT,    Left shift bits
+* @code{LSTAT}:         LSTAT,     Get file status
 * @code{LTIME}:         LTIME,     Convert time to local time info
 * @code{MALLOC}:        MALLOC,    Dynamic memory allocation function
 * @code{MATMUL}:        MATMUL,    matrix multiplication
@@ -270,7 +275,7 @@ names for an intrinsic procedure the kind type parameter will be explicitly
 given (e.g., @code{REAL(KIND=4)} or @code{REAL(KIND=8)}).  Finally, for
 brevity the optional @code{KIND=} syntax will be omitted.
 
-Many of the intrinsics procedures take one or more optional arguments.
+Many of the intrinsic procedures take one or more optional arguments.
 This document follows the convention used in the Fortran 95 standard,
 and denotes such arguments by square brackets.
 
@@ -286,7 +291,6 @@ cannot be intermixed in a given subprogram.  In the descriptions that follow,
 the applicable option(s) is noted.
 
 
-
 @node ABORT
 @section @code{ABORT} --- Abort the program  
 @findex @code{ABORT} intrinsic
@@ -324,7 +328,6 @@ end program test_abort
 @end table
 
 
-
 @node ABS
 @section @code{ABS} --- Absolute value  
 @findex @code{ABS} intrinsic
@@ -384,26 +387,58 @@ end program test_abs
 
 
 @node ACCESS
-@section @code{ACCESS} --- Checks file access method
+@section @code{ACCESS} --- Checks file access modes
 @findex @code{ACCESS} 
 @cindex file system functions
 
-Not yet implemented in GNU Fortran.
-
 @table @asis
 @item @emph{Description}:
+@code{ACCESS(NAME, MODE)} checks whether the file @var{NAME} 
+exists, is readable, writable or executable. Except for the
+executable check, @code{ACCESS} can be replaced by
+Fortran 95's @code{INQUIRE}.
 
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Inquiry function
+
 @item @emph{Syntax}:
+@code{I = ACCESS(NAME, MODE)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
+Tailing blank are ignored unless the character @code{achar(0)} is
+present, then all characters up to and excluding @code{achar(0)} are
+used as file name.
+@item @var{MODE} @tab Scalar @code{CHARACTER} with the file access mode,
+may be any concatenation of @code{"r"} (readable), @code{"w"} (writable)
+and @code{"x"} (executable), or @code{" "} to check for existence.
+@end multitable
+
 @item @emph{Return value}:
+Returns a scalar @code{INTEGER}, which is @code{0} if the file is
+accessable in the given mode; otherwise or if an invalid argument
+has been given for @code{MODE} the value @code{1} is returned.
+
 @item @emph{Example}:
+@smallexample
+program access_test
+  implicit none
+  character(len=*), parameter :: file  = 'test.dat'
+  character(len=*), parameter :: file2 = 'test.dat  '//achar(0)
+  if(access(file,' ') == 0) print *, trim(file),' is exists'
+  if(access(file,'r') == 0) print *, trim(file),' is readable'
+  if(access(file,'w') == 0) print *, trim(file),' is writable'
+  if(access(file,'x') == 0) print *, trim(file),' is executable'
+  if(access(file2,'rwx') == 0) &
+    print *, trim(file2),' is readable, writable and executable'
+end program access_test
+@end smallexample
 @item @emph{Specific names}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
@@ -694,8 +729,7 @@ F77 and later
 Elemental function
 
 @item @emph{Syntax}:
-@code{X = AINT(X)} 
-@code{X = AINT(X, KIND)}
+@code{X = AINT(X [, KIND])} 
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -754,8 +788,7 @@ GNU extension
 Subroutine
 
 @item @emph{Syntax}:
-@code{CALL ALARM(SECONDS, HANDLER)} 
-@code{CALL ALARM(SECONDS, HANDLER, STATUS)}
+@code{CALL ALARM(SECONDS, HANDLER [, STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -801,8 +834,7 @@ F95 and later
 transformational function
 
 @item @emph{Syntax}:
-@code{L = ALL(MASK)} 
-@code{L = ALL(MASK, DIM)}
+@code{L = ALL(MASK [, DIM])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -1693,7 +1725,7 @@ end program test_bit_size
 @node BTEST
 @section @code{BTEST} --- Bit test function
 @findex @code{BTEST} intrinsic
-@cindex BTEST
+@cindex bit operations
 
 @table @asis
 @item @emph{Description}:
@@ -1869,24 +1901,66 @@ END PROGRAM
 @findex @code{CHMOD} 
 @cindex file system functions
 
-Not yet implemented in GNU Fortran.
-
 @table @asis
 @item @emph{Description}:
+@code{CHMOD} changes the permissions of a file. This function invokes
+@code{/bin/chmod} and might therefore not work on all platforms.
+
+This intrinsic is provided in both subroutine and function forms; however,
+only one form can be used in any given program unit.
 
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
-Subroutine
+Subroutine, non-elemental function
 
 @item @emph{Syntax}:
+@multitable @columnfractions .80
+@item @code{CALL CHMOD(NAME, MODE[, STATUS])}
+@item @code{STATUS = CHMOD(NAME, MODE)}
+@end multitable
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{NAME} @tab Scalar @code{CHARACTER} with the file name.
+Trailing blanks are ignored unless the character @code{achar(0)} is
+present, then all characters up to and excluding @code{achar(0)} are
+used as the file name.
+
+@item @var{MODE} @tab Scalar @code{CHARACTER} giving the file permission.
+@var{MODE} uses the same syntax as the @var{MODE} argument of
+@code{/bin/chmod}.
+
+@item @var{STATUS} @tab (optional) scalar @code{INTEGER}, which is
+@code{0} on success and non-zero otherwise.
+@end multitable
+
 @item @emph{Return value}:
+In either syntax, @var{STATUS} is set to @code{0} on success and non-zero
+otherwise.
+
 @item @emph{Example}:
+@code{CHMOD} as subroutine
+@smallexample
+program chmod_test
+  implicit none
+  integer :: status
+  call chmod('test.dat','u+x',status)
+  print *, 'Status: ', status
+end program chmod_test
+@end smallexample
+@code{CHMOD} as non-elemental function:
+@smallexample
+program chmod_test
+  implicit none
+  integer :: status
+  status = chmod('test.dat','u+x')
+  print *, 'Status: ', status
+end program chmod_test
+@end smallexample
 @item @emph{Specific names}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
@@ -1937,9 +2011,10 @@ end program test_cmplx
 
 
 @node COMMAND_ARGUMENT_COUNT
-@section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function 
+@section @code{COMMAND_ARGUMENT_COUNT} --- Get number of command line arguments
 @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
-@cindex command argument count
+@cindex command line arguments
+@cindex getopt
 
 @table @asis
 @item @emph{Description}:
@@ -1971,9 +2046,10 @@ program test_command_argument_count
     print *, count
 end program test_command_argument_count
 @end smallexample
-@end table
-
 
+@item @emph{See also}:
+@ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
+@end table
 
 @node CONJG
 @section @code{CONJG} --- Complex conjugate function 
@@ -3273,7 +3349,7 @@ Subroutine
 @end multitable
 
 @item @emph{Return value}:
-The current date and time as a string.
+The current date as a string.
 
 @item @emph{Example}:
 @smallexample
@@ -3356,7 +3432,7 @@ GNU extension
 Non-elemental subroutine
 
 @item @emph{Syntax}:
-@code{CALL fget(C[,STATUS])}
+@code{CALL FGET(C[,STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -3411,7 +3487,7 @@ GNU extension
 Non-elemental subroutine
 
 @item @emph{Syntax}:
-@code{CALL fgetc(UNIT,C[,STATUS])}
+@code{CALL FGETC(UNIT,C[,STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -3584,7 +3660,7 @@ GNU extension
 Non-elemental subroutine
 
 @item @emph{Syntax}:
-@code{CALL fput(C[,STATUS])}
+@code{CALL FPUT(C[,STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -3634,7 +3710,7 @@ GNU extension
 Non-elemental subroutine
 
 @item @emph{Syntax}:
-@code{CALL fputc(UNIT,C[,STATUS])}
+@code{CALL FPUTC(UNIT,C[,STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -3750,22 +3826,37 @@ See @code{MALLOC} for an example.
 @node FSTAT
 @section @code{FSTAT} --- Get file status
 @findex @code{FSTAT} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex file system operations 
 
 @table @asis
 @item @emph{Description}:
-GNU extension
+@code{FSTAT} is identical to @ref{STAT}, except that information about an 
+already opened file is obtained.
+
+The elements in @code{BUFF} are the same as described by @ref{STAT}.
 
 @item @emph{Standard}:
+GNU extension
+
 @item @emph{Class}:
+Non-elemental subroutine
+
 @item @emph{Syntax}:
+@code{CALL fstat(UNIT,BUFF[,STATUS])}
+
 @item @emph{Arguments}:
-@item @emph{Return value}:
+@multitable @columnfractions .15 .80
+@item @var{UNIT}   @tab An open I/O unit number of type @code{INTEGER}.
+@item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
+@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
+                        on success and a system specific error code otherwise.
+@end multitable
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+See @ref{STAT} for an example.
+
 @item @emph{See also}:
+To stat a link: @ref{LSTAT}, to stat a file: @ref{STAT}
 @end table
 
 
@@ -3801,22 +3892,48 @@ Subroutine
 @node FTELL
 @section @code{FTELL} --- Current stream position
 @findex @code{FTELL} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
 
 @table @asis
 @item @emph{Description}:
+Retrieves the current position within an open file.
+
+This intrinsic is provided in both subroutine and function forms; however,
+only one form can be used in any given program unit.
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Subroutine, function
+
 @item @emph{Syntax}:
+@multitable @columnfractions .80
+@item @code{CALL FTELL(UNIT, OFFSET)}
+@item @code{OFFSET = FTELL(UNIT)}
+@end multitable
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{OFFSET}  @tab Shall of type @code{INTEGER}.
+@item @var{UNIT}    @tab Shall of type @code{INTEGER}.
+@end multitable
+
 @item @emph{Return value}:
+In either syntax, @var{OFFSET} is set to the current offset of unit
+number @var{UNIT}, or to @math{-1} if the unit is not currently open.
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_ftell
+  INTEGER :: i
+  OPEN(10, FILE="temp.dat")
+  CALL ftell(10,i)
+  WRITE(*,*) i
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
+@ref{FSEEK}
 @end table
 
 
@@ -3824,71 +3941,159 @@ GNU extension
 @node GETARG
 @section @code{GETARG} --- Get command line arguments
 @findex @code{GETARG} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex command line arguments
+@cindex getopt
 
 @table @asis
 @item @emph{Description}:
+Retrieve the @var{N}th argument that was passed on the
+command line when the containing program was invoked.
+
+This intrinsic routine is provided for backwards compatibility with 
+GNU Fortran 77.  In new code, programmers should consider the use of 
+the @ref{GET_COMMAND_ARGUMENT} intrinsic defined by the Fortran 2003 
+standard.
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Subroutine
+
 @item @emph{Syntax}:
+@code{CALL GETARG(N,ARG)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
+@item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
+@end multitable
+
 @item @emph{Return value}:
+After @code{GETARG} returns, the @var{ARG} argument holds the @var{N}th 
+command line argument. If @var{ARG} can not hold the argument, it is 
+truncated to fit the length of @var{ARG}. If there are less than @var{N}
+arguments specified at the command line, @var{ARG} will be filled with blanks.
+If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
+that support this feature).
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_getarg
+  INTEGER :: i
+  CHARACTER(len=32) :: arg
+
+  DO i = 1, iargc()
+    CALL getarg(i, arg)
+    WRITE (*,*) arg
+  END DO
+END PROGRAM
+@end smallexample
 
 @item @emph{See also}:
-@ref{IARGC}, @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}
+GNU Fortran 77 compatibility function: @ref{IARGC}
+
+F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
 @end table
 
 
 
 @node GET_COMMAND
-@section @code{GET_COMMAND} --- Subroutine to retrieve the entire command line
+@section @code{GET_COMMAND} --- Get the entire command line
 @findex @code{GET_COMMAND} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex command line arguments
+@cindex getopt
 
 @table @asis
 @item @emph{Description}:
+Retrieve the entire command line that was used to invoke the program.
+
 @item @emph{Standard}:
 F2003
 
 @item @emph{Class}:
+Subroutine
+
 @item @emph{Syntax}:
+@code{CALL GET_COMMAND(CMD)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{CMD} @tab Shall be of type @code{CHARACTER(*)}. 
+@end multitable
+
 @item @emph{Return value}:
+Stores the entire command line that was used to invoke the program in @var{ARG}. 
+If @var{ARG} is not large enough, the command will be truncated. 
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_get_command
+  CHARACTER(len=255) :: cmd
+  CALL get_command(cmd)
+  WRITE (*,*) TRIM(cmd)
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
+@ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
 @end table
 
 
 
 @node GET_COMMAND_ARGUMENT
-@section @code{GET_COMMAND_ARGUMENT} --- Subroutine to retrieve a command argument
+@section @code{GET_COMMAND_ARGUMENT} --- Get command line arguments
 @findex @code{GET_COMMAND_ARGUMENT} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex command line arguments
+@cindex getopt
 
 @table @asis
 @item @emph{Description}:
+Retrieve the @var{N}th argument that was passed on the
+command line when the containing program was invoked.
+
 @item @emph{Standard}:
 F2003
 
 @item @emph{Class}:
+Subroutine
+
 @item @emph{Syntax}:
+@code{CALL GET_COMMAND_ARGUMENT(N,ARG)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{N}   @tab Shall of type @code{INTEGER(4)}, @math{@var{N} \geq 0}
+@item @var{ARG} @tab Shall be of type @code{CHARACTER(*)}. 
+@end multitable
+
 @item @emph{Return value}:
+After @code{GET_COMMAND_ARGUMENT} returns, the @var{ARG} argument holds the 
+@var{N}th command line argument. If @var{ARG} can not hold the argument, it is 
+truncated to fit the length of @var{ARG}. If there are less than @var{N}
+arguments specified at the command line, @var{ARG} will be filled with blanks. 
+If @math{@var{N} = 0}, @var{ARG} is set to the name of the program (on systems
+that support this feature).
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_get_command_argument
+  INTEGER :: i
+  CHARACTER(len=32) :: arg
+
+  i = 0
+  DO
+    CALL get_command_argument(i, arg)
+    IF (LEN_TRIM(arg) == 0) EXIT
+
+    WRITE (*,*) TRIM(arg)
+    i = i+1
+  END DO
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
-@ref{COMMAND_ARGUMENT_COUNT}
+@ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}
 @end table
 
 
@@ -3909,7 +4114,7 @@ GNU extension
 Non-elemental subroutine.
 
 @item @emph{Syntax}:
-@code{CALL getcwd(CWD[,STATUS])}
+@code{CALL GETCWD(CWD[,STATUS])}
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .80
@@ -3936,21 +4141,46 @@ END PROGRAM
 @node GETENV
 @section @code{GETENV} --- Get an environmental variable
 @findex @code{GETENV} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex environment variable
 
 @table @asis
 @item @emph{Description}:
+Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
+
+This intrinsic routine is provided for backwards compatibility with 
+GNU Fortran 77.  In new code, programmers should consider the use of 
+the @ref{GET_ENVIRONMENT_VARIABLE} intrinsic defined by the Fortran
+2003 standard.
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Subroutine
+
 @item @emph{Syntax}:
+@code{CALL GETENV(ENVVAR,VALUE)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
+@item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
+@end multitable
+
 @item @emph{Return value}:
+Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
+not large enough to hold the data, it is truncated. If @var{ENVVAR}
+is not set, @var{VALUE} will be filled with blanks.
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_getenv
+  CHARACTER(len=255) :: homedir
+  CALL getenv("HOME", homedir)
+  WRITE (*,*) TRIM(homedir)
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
 @ref{GET_ENVIRONMENT_VARIABLE}
 @end table
@@ -3960,12 +4190,12 @@ GNU extension
 @node GET_ENVIRONMENT_VARIABLE
 @section @code{GET_ENVIRONMENT_VARIABLE} --- Get an environmental variable
 @findex @code{GET_ENVIRONMENT_VARIABLE} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex environment variable
 
 @table @asis
 @item @emph{Description}:
+Get the @var{VALUE} of the environmental variable @var{ENVVAR}.
+
 @item @emph{Standard}:
 F2003
 
@@ -3973,11 +4203,27 @@ F2003
 Subroutine
 
 @item @emph{Syntax}:
+@code{CALL GET_ENVIRONMENT_VARIABLE(ENVVAR,VALUE)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{ENVVAR} @tab Shall be of type @code{CHARACTER(*)}. 
+@item @var{VALUE}  @tab Shall be of type @code{CHARACTER(*)}. 
+@end multitable
+
 @item @emph{Return value}:
+Stores the value of @var{ENVVAR} in @var{VALUE}. If @var{VALUE} is 
+not large enough to hold the data, it is truncated. If @var{ENVVAR}
+is not set, @var{VALUE} will be filled with blanks.
+
 @item @emph{Example}:
-@item @emph{Specific names}:
-@item @emph{See also}:
+@smallexample
+PROGRAM test_getenv
+  CHARACTER(len=255) :: homedir
+  CALL get_environment_variable("HOME", homedir)
+  WRITE (*,*) TRIM(homedir)
+END PROGRAM
+@end smallexample
 @end table
 
 
@@ -4009,7 +4255,7 @@ kind.
 See @code{GETPID} for an example.
 
 @item @emph{See also}:
-@ref{GETPID}
+@ref{GETPID}, @ref{GETUID}
 @end table
 
 
@@ -4017,12 +4263,11 @@ See @code{GETPID} for an example.
 @node GETLOG
 @section @code{GETLOG} --- Get login name
 @findex @code{GETLOG} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
 
 @table @asis
 @item @emph{Description}:
+Gets the username under which the program is running.
+
 @item @emph{Standard}:
 GNU extension
 
@@ -4030,16 +4275,33 @@ GNU extension
 Subroutine
 
 @item @emph{Syntax}:
+@code{CALL GETLOG(LOGIN)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{LOGIN} @tab Shall be of type @code{CHARACTER(*)}.
+@end multitable
+
 @item @emph{Return value}:
+Stores the current user name in @var{LOGIN}.  (On systems where 
+the @code{getlogin(3)} function is not implemented, this will
+return a blank string.)
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM TEST_GETLOG
+  CHARACTER(32) :: login
+  CALL GETLOG(login)
+  WRITE(*,*) login
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
+@ref{GETUID}
 @end table
 
 
 
-
 @node GETPID
 @section @code{GETPID} --- Process ID function
 @findex @code{GETPID} intrinsic
@@ -4072,6 +4334,8 @@ program info
 end program info
 @end smallexample
 
+@item @emph{See also}:
+@ref{GETGID}, @ref{GETUID}
 @end table
 
 
@@ -4103,7 +4367,7 @@ kind.
 See @code{GETPID} for an example.
 
 @item @emph{See also}:
-@ref{GETPID}
+@ref{GETPID}, @ref{GETLOG}
 @end table
 
 
@@ -4130,7 +4394,6 @@ Subroutine
 @item @emph{Example}:
 @item @emph{Specific names}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
@@ -4139,22 +4402,38 @@ Subroutine
 @node HOSTNM
 @section @code{HOSTNM} --- Get system host name
 @findex @code{HOSTNM} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
 
 @table @asis
 @item @emph{Description}:
+Retrieves the host name of the system on which the program is running.
+
+This intrinsic is provided in both subroutine and function forms; however,
+only one form can be used in any given program unit.
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Subroutine, function
+
 @item @emph{Syntax}:
+@multitable @columnfractions .80
+@item @code{CALL HOSTNM(NAME, STATUS)}
+@item @code{STATUS = HOSTNM(NAME)}
+@end multitable
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{NAME}    @tab Shall of type @code{CHARACTER(*)}.
+@item @var{STATUS}  @tab (Optional) status flag of type @code{INTEGER}.
+                         Returns 0 on success, or a system specific error
+                         code otherwise.
+@end multitable
+
 @item @emph{Return value}:
-@item @emph{Example}:
-@item @emph{Specific names}:
-@item @emph{See also}:
+In either syntax, @var{NAME} is set to the current hostname if it can
+be obtained, or to a blank string otherwise.
+
 @end table
 
 
@@ -4245,10 +4524,10 @@ end program test_iachar
 @findex @code{IAND} intrinsic
 @cindex bit operations
 
-Intrinsic implemented, documentation pending.
-
 @table @asis
 @item @emph{Description}:
+Bitwise logical @code{AND}.
+
 @item @emph{Standard}:
 F95 and later
 
@@ -4256,10 +4535,25 @@ F95 and later
 Elemental function
 
 @item @emph{Syntax}:
+@code{RESULT = IAND(X, Y)}
+
 @item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{X} @tab The type shall be @code{INTEGER(*)}.
+@item @var{Y} @tab The type shall be @code{INTEGER(*)}.
+@end multitable
+
 @item @emph{Return value}:
+The return type is @code{INTEGER(*)} after cross-promotion of the arguments. 
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+@smallexample
+PROGRAM test_iand
+  INTEGER :: a, b
+  DATA a / Z'F' /, b / Z'3' /
+  WRITE (*,*) IAND(a, b)
+END PROGRAM
+@end smallexample
 
 @item @emph{See also}:
 @ref{IOR}, @ref{IEOR}, @ref{IBITS}, @ref{IBSET}, @ref{IBCLR},
@@ -4267,33 +4561,48 @@ Elemental function
 
 
 
-
 @node IARGC
-@section @code{IARGC} --- Get number of command line arguments
+@section @code{IARGC} --- Get the number of command line arguments
 @findex @code{IARGC} intrinsic
-@cindex undocumented intrinsic 
-
-Intrinsic implemented, documentation pending.
+@cindex command line arguments
+@cindex getopt
 
 @table @asis
 @item @emph{Description}:
+@code{IARGC()} returns the number of arguments passed on the
+command line when the containing program was invoked.
+
+This intrinsic routine is provided for backwards compatibility with 
+GNU Fortran 77.  In new code, programmers should consider the use of 
+the @ref{COMMAND_ARGUMENT_COUNT} intrinsic defined by the Fortran 2003 
+standard.
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Non-elemental Function
+
 @item @emph{Syntax}:
+@code{I = IARGC()}
+
 @item @emph{Arguments}:
+None.
+
 @item @emph{Return value}:
+The number of command line arguments, type @code{INTEGER(4)}.
+
 @item @emph{Example}:
-@item @emph{Specific names}:
+See @ref{GETARG}
+
 @item @emph{See also}:
-@ref{GETARG}, @ref{GET_COMMAND}, @ref{COMMAND_ARGUMENT_COUNT}, @ref{GET_COMMAND_ARGUMENT}
+GNU Fortran 77 compatibility subroutine: @ref{GETARG}
 
+F2003 functions and subroutines: @ref{GET_COMMAND}, @ref{GET_COMMAND_ARGUMENT}, @ref{COMMAND_ARGUMENT_COUNT}
 @end table
 
 
 
-
 @node IBCLR
 @section @code{IBCLR} --- Clear bit
 @findex @code{IBCLR} intrinsic
@@ -5104,7 +5413,7 @@ GNU extension
 @item @emph{Specific names}:
 
 @item @emph{See also}:
-@ref{INDEX}
+@ref{INDEX}, @ref{LEN_TRIM}
 @end table
 
 
@@ -5134,8 +5443,9 @@ Inquiry function
 @end multitable
 
 @item @emph{Return value}:
-The return value is of type @code{INTEGER(n)}, where @code{n} is the
-size (in bytes) of a memory address on the target machine.
+The return value is of type @code{INTEGER}, with a @code{KIND}
+corresponding to the size (in bytes) of a memory address on the target
+machine.
 
 @item @emph{Example}:
 @smallexample
@@ -5299,11 +5609,47 @@ Function
 @item @emph{Example}:
 @item @emph{Specific names}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
 
+@node LSTAT
+@section @code{LSTAT} --- Get file status
+@findex @code{LSTAT} intrinsic
+@cindex file system operations 
+
+@table @asis
+@item @emph{Description}:
+@code{LSTAT} is identical to @ref{STAT}, except that if path is a symbolic link, 
+then the link itself is statted, not the file that it refers to.
+
+The elements in @code{BUFF} are the same as described by @ref{STAT}.
+
+@item @emph{Standard}:
+GNU extension
+
+@item @emph{Class}:
+Non-elemental subroutine
+
+@item @emph{Syntax}:
+@code{CALL LSTAT(FILE,BUFF[,STATUS])}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
+@item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
+@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
+                        on success and a system specific error code otherwise.
+@end multitable
+
+@item @emph{Example}:
+See @ref{STAT} for an example.
+
+@item @emph{See also}:
+To stat an open file: @ref{FSTAT}, to stat a file: @ref{STAT}
+@end table
+
+
 
 @node LTIME
 @section @code{LTIME} --- Convert time to local time info
@@ -5327,7 +5673,6 @@ Subroutine
 @item @emph{Example}:
 @item @emph{Specific names}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
@@ -5845,8 +6190,8 @@ Elemental subroutine
 @code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
 @var{DEST}.  @var{SRC} will become deallocated in the process.
 
-@item @emph{Option}:
-f2003, gnu
+@item @emph{Standard}:
+F2003 and later
 
 @item @emph{Class}:
 Subroutine
@@ -6650,7 +6995,6 @@ Function
 @item @emph{Return value}:
 @item @emph{Example}:
 @item @emph{See also}:
-@uref{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19292, g77 features lacking in gfortran}
 
 @end table
 
@@ -7374,25 +7718,82 @@ pseudo-random number generators.
 @findex @code{STAT} intrinsic
 @cindex file system operations
 
-Intrinsic implemented, documentation pending.
-
 @table @asis
 @item @emph{Description}:
+This function returns information about a file. No permissions are required on 
+the file itself, but execute (search) permission is required on all of the 
+directories in path that lead to the file.
+
+The elements that are obtained and stored in the array @code{BUFF}:
+@multitable @columnfractions .15 .80
+@item @code{buff(1)}   @tab  Device ID 
+@item @code{buff(2)}   @tab  Inode number 
+@item @code{buff(3)}   @tab  File mode 
+@item @code{buff(4)}   @tab  Number of links 
+@item @code{buff(5)}   @tab  Owner's uid 
+@item @code{buff(6)}   @tab  Owner's gid 
+@item @code{buff(7)}   @tab  ID of device containing directory entry for file (0 if not available) 
+@item @code{buff(8)}   @tab  File size (bytes) 
+@item @code{buff(9)}   @tab  Last access time 
+@item @code{buff(10)}  @tab  Last modification time 
+@item @code{buff(11)}  @tab  Last file status change time 
+@item @code{buff(12)}  @tab  Preferred I/O block size (-1 if not available) 
+@item @code{buff(13)}  @tab  Number of blocks allocated (-1 if not available)
+@end multitable
+
+Not all these elements are relevant on all systems. 
+If an element is not relevant, it is returned as 0.
+
+
 @item @emph{Standard}:
 GNU extension
 
 @item @emph{Class}:
+Non-elemental subroutine
+
 @item @emph{Syntax}:
+@code{CALL STAT(FILE,BUFF[,STATUS])}
+
 @item @emph{Arguments}:
-@item @emph{Return value}:
+@multitable @columnfractions .15 .80
+@item @var{FILE}   @tab The type shall be @code{CHARACTER(*)}, a valid path within the file system.
+@item @var{BUFF}   @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
+@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0 
+                        on success and a system specific error code otherwise.
+@end multitable
+
 @item @emph{Example}:
+@smallexample
+PROGRAM test_stat
+  INTEGER, DIMENSION(13) :: buff
+  INTEGER :: status
+
+  CALL STAT("/etc/passwd", buff, status)
+
+  IF (status == 0) THEN
+    WRITE (*, FMT="('Device ID:',               T30, I19)") buff(1)
+    WRITE (*, FMT="('Inode number:',            T30, I19)") buff(2)
+    WRITE (*, FMT="('File mode (octal):',       T30, O19)") buff(3)
+    WRITE (*, FMT="('Number of links:',         T30, I19)") buff(4)
+    WRITE (*, FMT="('Owner''s uid:',            T30, I19)") buff(5)
+    WRITE (*, FMT="('Owner''s gid:',            T30, I19)") buff(6)
+    WRITE (*, FMT="('Device where located:',    T30, I19)") buff(7)
+    WRITE (*, FMT="('File size:',               T30, I19)") buff(8)
+    WRITE (*, FMT="('Last access time:',        T30, A19)") CTIME(buff(9))
+    WRITE (*, FMT="('Last modification time',   T30, A19)") CTIME(buff(10))
+    WRITE (*, FMT="('Last status change time:', T30, A19)") CTIME(buff(11))
+    WRITE (*, FMT="('Preferred block size:',    T30, I19)") buff(12)
+    WRITE (*, FMT="('No. of blocks allocated:', T30, I19)") buff(13)
+  END IF
+END PROGRAM
+@end smallexample
+
 @item @emph{See also}:
-@ref{FSTAT}
+To stat an open file: @ref{FSTAT}, to stat a link: @ref{LSTAT}
 @end table
 
 
 
-
 @node SUM
 @section @code{SUM} --- Sum of array elements
 @findex @code{SUM} intrinsic