diff options
Diffstat (limited to 'gcc/fortran/intrinsic.texi')
-rw-r--r-- | gcc/fortran/intrinsic.texi | 184 |
1 files changed, 126 insertions, 58 deletions
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 3103da3..6b9f4cd 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -313,6 +313,7 @@ Some basic guidelines for editing this document: * @code{SIZEOF}: SIZEOF, Determine the size in bytes of an expression * @code{SLEEP}: SLEEP, Sleep for the specified number of seconds * @code{SPACING}: SPACING, Smallest distance between two numbers of a given type +* @code{SPLIT}: SPLIT, Parse a string into tokens, one at a time. * @code{SPREAD}: SPREAD, Add a dimension to an array * @code{SQRT}: SQRT, Square-root function * @code{SRAND}: SRAND, Reinitialize the random number generator @@ -3367,11 +3368,13 @@ Fortran 2003 and later @table @asis @item @emph{Synopsis}: -@code{CALL C_F_POINTER(CPTR, FPTR[, SHAPE])} +@code{CALL C_F_POINTER(CPTR, FPTR[, SHAPE, LOWER])} @item @emph{Description}: -@code{C_F_POINTER(CPTR, FPTR[, SHAPE])} assigns the target of the C pointer -@var{CPTR} to the Fortran pointer @var{FPTR} and specifies its shape. +@code{C_F_POINTER(CPTR, FPTR[, SHAPE, LOWER])} assigns the target of the C +pointer @var{CPTR} to the Fortran pointer @var{FPTR} and specifies its shape. +For an array @var{FPTR}, the lower bounds are specified by @var{LOWER} if +present and otherwise equal to 1. @item @emph{Class}: Subroutine @@ -3383,9 +3386,11 @@ Subroutine @item @var{FPTR} @tab pointer interoperable with @var{cptr}. It is @code{INTENT(OUT)}. @item @var{SHAPE} @tab (Optional) Rank-one array of type @code{INTEGER} -with @code{INTENT(IN)}. It shall be present -if and only if @var{fptr} is an array. The size -must be equal to the rank of @var{fptr}. +with @code{INTENT(IN)}. It shall be present if and only if @var{FPTR} is an +array. The size must be equal to the rank of @var{FPTR}. +@item @var{LOWER} @tab (Optional) Rank-one array of type @code{INTEGER} +with @code{INTENT(IN)}. It shall not be present if @var{SHAPE} is not present. +The size must be equal to the rank of @var{FPTR}. @end multitable @item @emph{Example}: @@ -3407,7 +3412,7 @@ end program main @end smallexample @item @emph{Standard}: -Fortran 2003 and later +Fortran 2003 and later, with @var{LOWER} argument Fortran 2023 and later @item @emph{See also}: @ref{C_LOC}, @* @@ -6809,7 +6814,6 @@ GNU extension @end table - @node FRACTION @section @code{FRACTION} --- Fractional part of the model representation @fnindex FRACTION @@ -6835,14 +6839,15 @@ Elemental function @item @emph{Return value}: The return value is of the same type and kind as the argument. The fractional part of the model representation of @code{X} is returned; -it is @code{X * RADIX(X)**(-EXPONENT(X))}. +it is @code{X * REAL(RADIX(X))**(-EXPONENT(X))}. @item @emph{Example}: @smallexample program test_fraction + implicit none real :: x x = 178.1387e-4 - print *, fraction(x), x * radix(x)**(-exponent(x)) + print *, fraction(x), x * real(radix(x))**(-exponent(x)) end program test_fraction @end smallexample @@ -14203,6 +14208,69 @@ Fortran 90 and later +@node SPLIT +@section @code{SPLIT} --- Parse a string into tokens, one at a time +@fnindex SPLIT +@cindex string, split + +@table @asis +@item @emph{Synopsis}: +@code{RESULT = SPLIT(STRING, SET, POS [, BACK])} + +@item @emph{Description}: +Updates the integer @var{POS} to the position of the next (or previous) +separator in @var{STRING}. + +If @var{BACK} is absent or is present with the value false, @var{POS} is +assigned the position of the leftmost token delimiter in @var{STRING} whose +position is greater than @var{POS}, or if there is no such character, it is +assigned a value one greater than the length of @var{STRING}. This identifies +a token with starting position one greater than the value of @var{POS} on +invocation, and ending position one less than the value of @var{POS} on return. + +If @var{BACK} is present with the value true, @var{POS} is assigned the +position of the rightmost token delimiter in @var{STRING} whose position is +less than @var{POS}, or if there is no such character, it is assigned the value +zero. This identifies a token with ending position one less than the value of +@var{POS} on invocation, and starting position one greater than the value of +@var{POS} on return. + +@item @emph{Class}: +Subroutine + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{STRING} @tab Shall be of type @code{CHARACTER}. +@item @var{SET} @tab Shall be of type @code{CHARACTER}. +@item @var{POS} @tab Shall be of type @code{INTEGER}. +@item @var{BACK} @tab (Optional) Shall be of type @code{LOGICAL}. +@end multitable + +@item @emph{Example}: +@smallexample +character(len=:), allocatable :: input +character(len=2) :: set = ', ' +integer :: p +input = "one,last example" +p = 0 +do + if (p > len(input)) exit + istart = p + 1 + call split(input, set, p) + iend = p - 1 + print '(t7, a)', input(istart:iend) +end do +@end smallexample + +@item @emph{Standard}: +Fortran 2023 + +@item @emph{See also}: +@ref{SCAN} +@end table + + + @node SPREAD @section @code{SPREAD} --- Add a dimension to an array @fnindex SPREAD @@ -14875,54 +14943,6 @@ Fortran 77 and later, for a complex argument Fortran 2008 or later -@node TEAM_NUMBER -@section @code{TEAM_NUMBER} --- Retrieve team id of given team -@fnindex TEAM_NUMBER -@cindex coarray, @code{TEAM_NUMBER} -@cindex teams, index of given team - -@table @asis -@item @emph{Synopsis}: -@item @code{RESULT = TEAM_NUMBER([TEAM])} - -@item @emph{Description}: -Returns the team id for the given @var{TEAM} as assigned by @code{FORM TEAM}. -If @var{TEAM} is absent, returns the team number of the current team. - -@item @emph{Class}: -Transformational function - -@item @emph{Arguments}: -@multitable @columnfractions .15 .70 -@item @var{TEAM} @tab (optional, intent(in)) The handle of the team for which -the number, aka id, is desired. -@end multitable - -@item @emph{Return value}: -Default integer. The id as given in a call @code{FORM TEAM}. Applying -@code{TEAM_NUMBER} to the initial team will result in @code{-1} to be returned. -Returns the id of the current team, if @var{TEAM} is null. - -@item @emph{Example}: -@smallexample -use, intrinsic :: iso_fortran_env -type(team_type) :: t - -print *, team_number() ! -1 -form team (99, t) -print *, team_number(t) ! 99 -@end smallexample - -@item @emph{Standard}: -Fortran 2018 and later. - -@item @emph{See also}: -@ref{GET_TEAM}, @* -@ref{TEAM_NUMBER} -@end table - - - @node TANPI @section @code{TANPI} --- Circular tangent function @fnindex TANPI @@ -14972,6 +14992,54 @@ end program test_tanpi +@node TEAM_NUMBER +@section @code{TEAM_NUMBER} --- Retrieve team id of given team +@fnindex TEAM_NUMBER +@cindex coarray, @code{TEAM_NUMBER} +@cindex teams, index of given team + +@table @asis +@item @emph{Synopsis}: +@item @code{RESULT = TEAM_NUMBER([TEAM])} + +@item @emph{Description}: +Returns the team id for the given @var{TEAM} as assigned by @code{FORM TEAM}. +If @var{TEAM} is absent, returns the team number of the current team. + +@item @emph{Class}: +Transformational function + +@item @emph{Arguments}: +@multitable @columnfractions .15 .70 +@item @var{TEAM} @tab (optional, intent(in)) The handle of the team for which +the number, aka id, is desired. +@end multitable + +@item @emph{Return value}: +Default integer. The id as given in a call @code{FORM TEAM}. Applying +@code{TEAM_NUMBER} to the initial team will result in @code{-1} to be returned. +Returns the id of the current team, if @var{TEAM} is null. + +@item @emph{Example}: +@smallexample +use, intrinsic :: iso_fortran_env +type(team_type) :: t + +print *, team_number() ! -1 +form team (99, t) +print *, team_number(t) ! 99 +@end smallexample + +@item @emph{Standard}: +Fortran 2018 and later. + +@item @emph{See also}: +@ref{GET_TEAM}, @* +@ref{TEAM_NUMBER} +@end table + + + @node THIS_IMAGE @section @code{THIS_IMAGE} --- Function that returns the cosubscript index of this image @fnindex THIS_IMAGE |