This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch/gfortran] Intrinsic docs
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 30 May 2005 22:59:20 -0700
- Subject: [Patch/gfortran] Intrinsic docs
Attached is patch that adds documentation for the following intrinsics:
Can someone please review and commit for me if OK
Tested with make info and make dvi
2005-05-30 Jerry DeLisle <jvdelisle@verizon.net>
* fortran/intrinisic.texi: Add documentation for
command_argument_count, conjg, dconjg, count, cpu_time,
cshift, date_and_time, dble, and dfloat.
Regards,
Jerry
Index: intrinsic.texi
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/intrinsic.texi,v
retrieving revision 1.10
diff -c -3 -p -r1.10 intrinsic.texi
*** intrinsic.texi 28 May 2005 16:41:31 -0000 1.10
--- intrinsic.texi 31 May 2005 05:33:05 -0000
*************** and editing. All contributions and corr
*** 36,42 ****
* @code{ABORT}: ABORT, Abort the program
* @code{ABS}: ABS, Absolute value
* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
! * @code{ACOS}: ACOS, Arccosine function
* @code{ADJUSTL}: ADJUSTL, Left adjust a string
* @code{ADJUSTR}: ADJUSTR, Right adjust a string
* @code{AIMAG}: AIMAG, Imaginary part of complex number
--- 36,42 ----
* @code{ABORT}: ABORT, Abort the program
* @code{ABS}: ABS, Absolute value
* @code{ACHAR}: ACHAR, Character in @acronym{ASCII} collating sequence
! * @code{ACOS}: ACOS, Arc cosine function
* @code{ADJUSTL}: ADJUSTL, Left adjust a string
* @code{ADJUSTR}: ADJUSTR, Right adjust a string
* @code{AIMAG}: AIMAG, Imaginary part of complex number
*************** and editing. All contributions and corr
*** 60,67 ****
--- 60,75 ----
* @code{CEILING}: CEILING, Integer ceiling function
* @code{CHAR}: CHAR, Character conversion function
* @code{CMPLX}: CMPLX, Complex conversion function
+ * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Command line argument count
+ * @code{CONJG}: CONJG, Complex conjugate function
* @code{COS}: COS, Cosine function
* @code{COSH}: COSH, Hyperbolic cosine function
+ * @code{COUNT}: COUNT, Count logical .TRUE. occurrences in array mask
+ * @code{CPU_TIME}: CPU_TIME, CPU time subroutine
+ * @code{CSHIFT}: CSHIFT, Circular array shift
+ * @code{DATE_AND_TIME}: DATE_AND_TIME, Date and time subroutine
+ * @code{DBLE}: DBLE, Double precision conversion
+ * @code{DFLOAT}: DFLOAT, Double precision conversion
* @code{ERF}: ERF, Error function
* @code{ERFC}: ERFC, Complementary error function
* @code{EXP}: EXP, Cosine function
*************** end program test_achar
*** 248,261 ****
@node ACOS
! @section @code{ACOS} --- Arccosine function
@findex @code{ACOS} intrinsic
@findex @code{DACOS} intrinsic
! @cindex arccosine
@table @asis
@item @emph{Description}:
! @code{ACOS(X)} computes the arccosine of its @var{X}.
@item @emph{Option}:
f95, gnu
--- 256,269 ----
@node ACOS
! @section @code{ACOS} --- Arc cosine function
@findex @code{ACOS} intrinsic
@findex @code{DACOS} intrinsic
! @cindex arc cosine
@table @asis
@item @emph{Description}:
! @code{ACOS(X)} computes the arc cosine of its @var{X}.
@item @emph{Option}:
f95, gnu
*************** initialization expression.
*** 453,459 ****
@item @emph{Return value}:
The return value is of type real with the kind type parameter of the
! argument if the optional @var{KIND} is absence; otherwise, the kind
type parameter will be given by @var{KIND}. If the magnitude of
@var{X} is less than one, then @code{AINT(X)} returns zero. If the
magnitude is equal to or greater than one, then it returns the largest
--- 461,467 ----
@item @emph{Return value}:
The return value is of type real with the kind type parameter of the
! argument if the optional @var{KIND} is absent; otherwise, the kind
type parameter will be given by @var{KIND}. If the magnitude of
@var{X} is less than one, then @code{AINT(X)} returns zero. If the
magnitude is equal to or greater than one, then it returns the largest
*************** end program test_all
*** 555,561 ****
@table @asis
@item @emph{Description}:
! @code{ALLOCATED(X)} checks the status of wether @var{X} is allocated.
@item @emph{Option}:
f95, gnu
--- 563,569 ----
@table @asis
@item @emph{Description}:
! @code{ALLOCATED(X)} checks the status of whether @var{X} is allocated.
@item @emph{Option}:
f95, gnu
*************** initialization expression.
*** 617,623 ****
@item @emph{Return value}:
The return value is of type real with the kind type parameter of the
! argument if the optional @var{KIND} is absence; otherwise, the kind
type parameter will be given by @var{KIND}. If @var{X} is greater than
zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
less than or equal to zero, then return @code{AINT(X-0.5)}.
--- 625,631 ----
@item @emph{Return value}:
The return value is of type real with the kind type parameter of the
! argument if the optional @var{KIND} is absent; otherwise, the kind
type parameter will be given by @var{KIND}. If @var{X} is greater than
zero, then @code{ANINT(X)} returns @code{AINT(X+0.5)}. If @var{X} is
less than or equal to zero, then return @code{AINT(X-0.5)}.
*************** end program test_cmplx
*** 1410,1415 ****
--- 1418,1508 ----
+ @node COMMAND_ARGUMENT_COUNT
+ @section @code{COMMAND_ARGUMENT_COUNT} --- Argument count function
+ @findex @code{COMMAND_ARGUMENT_COUNT} intrinsic
+ @cindex command argument count
+
+ @table @asis
+ @item @emph{Description}:
+ @code{COMMAND_ARGUMENT_COUNT()} returns the number of arguments passed on the command line when the containing program was invoked.
+
+ @item @emph{Option}:
+ f2003, gnu
+
+ @item @emph{Class}:
+ non-elemental function
+
+ @item @emph{Syntax}:
+ @code{I = COMMAND_ARGUMENT_COUNT()}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item No arguments allowed.
+ @end multitable
+
+ @item @emph{Return value}:
+ The return value is of type @code{INTEGER(4)}
+
+ @item @emph{Example}:
+ @smallexample
+ program test_command_argument_count
+ integer :: count
+ count = command_argument_count()
+ print *, count
+ end program test_command_argument_count
+ @end smallexample
+ @end table
+
+
+
+ @node CONJG
+ @section @code{CONJG} --- Complex conjugate function
+ @findex @code{CONJG} intrinsic
+ @findex @code{DCONJG} intrinsic
+ @cindex complex conjugate
+ @table @asis
+ @item @emph{Description}:
+ @code{CONJG(Z)} returns the conjugate of @var{Z}. If @var{Z} is @code{(x, y)} then the result is @code{(x, -y)}
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ elemental function
+
+ @item @emph{Syntax}:
+ @code{Z = CONJG(Z)}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{Z} @tab The type shall be @code{COMPLEX(*)}.
+ @end multitable
+
+ @item @emph{Return value}:
+ The return value is of type @code{COMPLEX(*)}.
+
+ @item @emph{Example}:
+ @smallexample
+ program test_conjg
+ complex :: z = (2.0, 3.0)
+ complex(8) :: dz = (2.71_8, -3.14_8)
+ z= conjg(z)
+ print *, z
+ dz = dconjg(dz)
+ print *, dz
+ end program test_conjg
+ @end smallexample
+
+ @item @emph{Specific names}:
+ @multitable @columnfractions .24 .24 .24 .24
+ @item Name @tab Argument @tab Return type @tab Option
+ @item @code{DCONJG(Z)} @tab @code{COMPLEX(8) Z} @tab @code{COMPLEX(8)} @tab gnu
+ @end multitable
+ @end table
+
+
+
@node COS
@section @code{COS} --- Cosine function
@findex @code{COS} intrinsic
*************** elemental function
*** 1438,1444 ****
@end multitable
@item @emph{Return value}:
! The return value has same type and kind than @var{X}.
@item @emph{Example}:
@smallexample
--- 1531,1537 ----
@end multitable
@item @emph{Return value}:
! The return value has same type and kind as @var{X}.
@item @emph{Example}:
@smallexample
*************** end program test_cosh
*** 1505,1510 ****
--- 1598,1853 ----
+ @node COUNT
+ @section @code{COUNT} --- Count function
+ @findex @code{COUNT} intrinsic
+ @cindex count
+
+ @table @asis
+ @item @emph{Description}:
+ @code{COUNT(MASK[,DIM])} counts the number of @code{.TRUE.} elements of @var{MASK} along the dimension of @var{DIM}. If @var{DIM} is omitted it is taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{MASK}.
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ transformational function
+
+ @item @emph{Syntax}:
+ @code{I = COUNT(MASK)}
+ @code{I = COUNT(MASK, DIM)}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{MASK} @tab The type shall be @code{LOGICAL}.
+ @item @var{DIM} @tab The type shall be @code{INTEGER}.
+ @end multitable
+
+ @item @emph{Return value}:
+ The return value is of type @code{INTEGER} with rank equal to that of @var{MASK}.
+
+ @item @emph{Example}:
+ @smallexample
+
+ @end smallexample
+ program test_count
+ integer, dimension(2,3) :: a, b
+ logical, dimension(2,3) :: mask
+ a = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/ 2, 3 /))
+ b = reshape( (/ 0, 7, 3, 4, 5, 8 /), (/ 2, 3 /))
+ print '(3i3)', a(1,:)
+ print '(3i3)', a(2,:)
+ print *
+ print '(3i3)', b(1,:)
+ print '(3i3)', b(2,:)
+ print *
+ mask = a.ne.b
+ print '(3l3)', mask(1,:)
+ print '(3l3)', mask(2,:)
+ print *
+ print '(3i3)', count(mask)
+ print *
+ print '(3i3)', count(mask, 1)
+ print *
+ print '(3i3)', count(mask, 2)
+ end program test_count
+ @end table
+
+
+
+ @node CPU_TIME
+ @section @code{CPU_TIME} --- CPU time subroutine
+ @findex @code{CPU_TIME} intrinsic
+ @cindex CPU_TIME
+
+ @table @asis
+ @item @emph{Description}:
+ Determine the CPU time in a processor-dependent way in seconds. This is useful for testing segments of code to determine execution time.
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ subroutine
+
+ @item @emph{Syntax}:
+ @code{CPU_TIME(X)}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{X} @tab The type shall be @code{REAL} with intent out.
+ @end multitable
+
+ @item @emph{Return value}:
+ None
+
+ @item @emph{Example}:
+ @smallexample
+ program test_cpu_time
+ real :: start, finish
+ call cpu_time(start)
+ ! put code to test here
+ call cpu_time(finish)
+ print '("Time = ",f6.3," seconds.")',finish-start
+ end program test_cpu_time
+ @end smallexample
+ @end table
+
+
+
+ @node CSHIFT
+ @section @code{CSHIFT} --- Circular shift function
+ @findex @code{CSHIFT} intrinsic
+ @cindex cshift intrinsic
+
+ @table @asis
+ @item @emph{Description}:
+ @code{CSHIFT(ARRAY, SHIFT[,DIM])} performs a circular shift on elements of @var{ARRAY} along the dimension of @var{DIM}. If @var{DIM} is omitted it is taken to be @code{1}. @var{DIM} is a scaler of type @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}. If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one, then all complete rank one sections of @var{ARRAY} along the given dimension are shifted. Elements shifted out one end of each rank one section are shifted back in the other end.
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ transformational function
+
+ @item @emph{Syntax}:
+ @code{A = CSHIFT(A, SHIFT[,DIM])}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{ARRAY} @tab May be any type, not scaler.
+ @item @var{SHIFT} @tab The type shall be @code{INTEGER}.
+ @item @var{DIM} @tab The type shall be @code{INTEGER}.
+ @end multitable
+
+ @item @emph{Return value}:
+ Returns an array of same type and rank as the @var{ARRAY} argument.
+
+ @item @emph{Example}:
+ @smallexample
+ program test_cshift
+ integer, dimension(3,3) :: a
+ a = reshape( (/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), (/ 3, 3 /))
+ print '(3i3)', a(1,:)
+ print '(3i3)', a(2,:)
+ print '(3i3)', a(3,:)
+ a = cshift(a, SHIFT=(/1, 2, -1/), DIM=2)
+ print *
+ print '(3i3)', a(1,:)
+ print '(3i3)', a(2,:)
+ print '(3i3)', a(3,:)
+ end program test_cshift
+ @end smallexample
+ @end table
+
+
+
+ @node DATE_AND_TIME
+ @section @code{DATE_AND_TIME} --- Date and time subroutine
+ @findex @code{DATE_AND_TIME} intrinsic
+ @cindex DATE_AND_TIME
+
+ @table @asis
+ @item @emph{Description}:
+ @code{DATE_AND_TIME(DATE, TIME, ZONE, VALUES)} gets the corresponding date and time information from the real-time system clock. @var{DATE} is @code{INTENT(OUT)} and has form ccyymmdd. @var{TIME} is @code{INTENT(OUT)} and has form hhmmss.sss. @var{ZONE} is @code{INTENT(OUT)} and has form (+-)hhmm, representing the difference with respect to Coordinated Universal Time (UTC). Unavailable time and date parameters return blanks.
+
+ @var{VALUES} is @code{INTENT(OUT)} and provides the following
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ subroutine
+
+ @item @emph{Syntax}:
+ @code{CALL DATE_AND_TIME([DATE, TIME, ZONE, VALUES])}
+
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(8)} or larger.
+ @item @var{TIME} @tab (OPtional) The type shall be @code{CHARACTER(10)} or larger.
+ @item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(5)} or larger.
+ @item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}
+ @end multitable
+
+ @item @emph{Return value}:
+ None
+
+ @item @emph{Example}:
+ @smallexample
+ program test_time_and_date
+ character(8) :: date
+ character(10) :: time
+ character(5) :: zone
+ integer,dimension(8) :: values
+ ! using keyword arguments
+ call date_and_time(date,time,zone,values)
+ call date_and_time(DATE=date,ZONE=zone)
+ call date_and_time(TIME=time)
+ call date_and_time(VALUES=values)
+ print '(a,2x,a,2x,a)', date, time, zone
+ print '(8i5))', values
+ end program test_time_and_date
+ @end smallexample
+ @end table
+
+
+
+ @node DBLE
+ @section @code{DBLE} --- Double conversion function
+ @findex @code{DBLE} intrinsic
+ @cindex double conversion
+
+ @table @asis
+ @item @emph{Description}:
+ @code{DBLE(X)} Converts @var{X} to double precision real type.
+ @code{DFLOAT} is an alias for @code{DBLE}
+
+ @item @emph{Option}:
+ f95, gnu
+
+ @item @emph{Class}:
+ elemental function
+
+ @item @emph{Syntax}:
+ @code{X = DBLE(X)}
+ @code{X = DFLOAT(X)}
+
+ @item @emph{Arguments}:
+ @multitable @columnfractions .15 .80
+ @item @var{X} @tab The type shall be @code{INTEGER(*)}, @code{REAL(*)}, or @code{COMPLEX(*)}.
+ @end multitable
+
+ @item @emph{Return value}:
+ The return value is of type double precision real.
+
+ @item @emph{Example}:
+ @smallexample
+ program test_dble
+ real :: x = 2.18
+ integer :: i = 5
+ complex :: z = (2.3,1.14)
+ print *, dble(x), dble(i), dfloat(z)
+ end program test_dble
+ @end smallexample
+ @end table
+
+
+
+ @node DFLOAT
+ @section @code{DFLOAT} --- Double conversion function
+ @findex @code{DFLOAT} intrinsic
+ @cindex double float conversion
+
+ @table @asis
+ @item @emph{Description}:
+ @code{DFLOAT(X)} Converts @var{X} to double precision real type.
+ @code{DFLOAT} is an alias for @code{DBLE}. See @code{DBLE}.
+ @end table
+
+
+
@node ERF
@section @code{ERF} --- Error function
@findex @code{ERF} intrinsic
*************** end program test_tanh
*** 1985,2006 ****
- @comment gen command_argument_count
- @comment
- @comment gen conjg
- @comment dconjg
- @comment
- @comment gen count
- @comment
- @comment sub cpu_time
- @comment
- @comment gen cshift
- @comment
- @comment sub date_and_time
- @comment
- @comment gen dble
- @comment dfloat
- @comment
@comment gen dcmplx
@comment
@comment gen digits
--- 2328,2333 ----