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
* @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
* @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
* @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
* @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
* @code{MINVAL}: MINVAL, Minimum value of an array
* @code{MOD}: MOD, Remainder function
* @code{MODULO}: MODULO, Modulo function
+* @code{MOVE_ALLOC}: MOVE_ALLOC, Move allocation from one object to another
* @code{MVBITS}: MVBITS, Move bits from one integer to another
* @code{NEAREST}: NEAREST, Nearest representable number
* @code{NEW_LINE}: NEW_LINE, New line character
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.
the applicable option(s) is noted.
-
@node ABORT
@section @code{ABORT} --- Abort the program
@findex @code{ABORT} intrinsic
@end table
-
@node ABS
@section @code{ABS} --- Absolute value
@findex @code{ABS} intrinsic
@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
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
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
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
@node BTEST
@section @code{BTEST} --- Bit test function
@findex @code{BTEST} intrinsic
-@cindex BTEST
+@cindex bit operations
@table @asis
@item @emph{Description}:
@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
@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}:
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
@end multitable
@item @emph{Return value}:
-The current date and time as a string.
+The current date as a string.
@item @emph{Example}:
@smallexample
Non-elemental subroutine
@item @emph{Syntax}:
-@code{CALL fget(C[,STATUS])}
+@code{CALL FGET(C[,STATUS])}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
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
Non-elemental subroutine
@item @emph{Syntax}:
-@code{CALL fput(C[,STATUS])}
+@code{CALL FPUT(C[,STATUS])}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
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
@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
@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
@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
Non-elemental subroutine.
@item @emph{Syntax}:
-@code{CALL getcwd(CWD[,STATUS])}
+@code{CALL GETCWD(CWD[,STATUS])}
@item @emph{Arguments}:
@multitable @columnfractions .15 .80
@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
@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
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
See @code{GETPID} for an example.
@item @emph{See also}:
-@ref{GETPID}
+@ref{GETPID}, @ref{GETUID}
@end table
@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
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
end program info
@end smallexample
+@item @emph{See also}:
+@ref{GETGID}, @ref{GETUID}
@end table
See @code{GETPID} for an example.
@item @emph{See also}:
-@ref{GETPID}
+@ref{GETPID}, @ref{GETLOG}
@end table
@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 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
@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
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},
-
@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
@item @emph{Specific names}:
@item @emph{See also}:
-@ref{INDEX}
+@ref{INDEX}, @ref{LEN_TRIM}
@end table
@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
@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
@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 MOVE_ALLOC
+@section @code{MOVE_ALLOC} --- Move allocation from one object to another
+@findex @code{MOVE_ALLOC} intrinsic
+@cindex MOVE_ALLOC
+
+@table @asis
+@item @emph{Description}:
+@code{MOVE_ALLOC(SRC, DEST)} moves the allocation from @var{SRC} to
+@var{DEST}. @var{SRC} will become deallocated in the process.
+
+@item @emph{Standard}:
+F2003 and later
+
+@item @emph{Class}:
+Subroutine
+
+@item @emph{Syntax}:
+@code{CALL MOVE_ALLOC(SRC, DEST)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .80
+@item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be of any type and kind.
+@item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be of the same type, kind and rank as @var{SRC}
+@end multitable
+
+@item @emph{Return value}:
+None
+
+@item @emph{Example}:
+@smallexample
+program test_move_alloc
+ integer, allocatable :: a(:), b(:)
+
+ allocate(a(3))
+ a = [ 1, 2, 3 ]
+ call move_alloc(a, b)
+ print *, allocated(a), allocated(b)
+ print *, b
+end program test_move_alloc
+@end smallexample
+@end table
+
+
+
@node NEAREST
@section @code{NEAREST} --- Nearest representable number
@findex @code{NEAREST} intrinsic
@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
@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