[Previous]
NAME:
gnu_intrinsic
PURPOSE:
Couple of missing intrinsic functions for use with gfortran
CATEGORY:
gen/cpp/os
CALLING SEQUENCE:
idate_(dmy)
itime_(hms)
pa = loc_(ptr_a) (commented out)
INPUTS:
prt_a anything (I think)
pointer for which address is required
OUTPUTS:
dmy[3] int day of monty, month, year
hms[3] int time of day (hours, minutes, seconds)
pa long address of ptr_a
CALLS:
SEE ALSO:
INCLUDE:
SIDE EFFECTS:
RESTRICTIONS:
EXAMPLE:
PROCEDURE:
The times are extracted from a tm structure:
int tm_sec seconds after minute [0-61] (61 allows for 2 leap-seconds)
int tm_min minutes after hour [0-59]
int tm_hour hours after midnight [0-23]
int tm_mday day of the month [1-31]
int tm_mon month of year [0-11]
int tm_year current year-1900
int tm_wday days since Sunday [0-6]
int tm_yday days since January 1st [0-365]
int tm_isdst daylight savings indicator
In Fortran the time functions are used only by OSGetDateAndTime as
call IDATE(ymd)
call ITIME(hms)
ymd and hms are both declared as 3-element integer arrays, i.e.
usually (always?) this means integer*4, or type 'int' in C.
The loc_ function is called only in forays.f to get addresses
of arrays. This is not (yet) available in gfortran, hence this
workaround.
Pointers in C apparently are of type 'long'. On 32-bit machines
'long' means 4-byte type 'int'. However, on the 64-bit AMD machine
it appears that 'long' is 8 longs (i.e. integer*8).
The argument to loc_ is declared to be of type 'long'. I think
it can be called from Fortran with any type, since all we need
is the pointer.
MODIFICATION HISTORY:
DEC-2004, Paul Hick (UCSD/CASS; pphick@ucsd.edu)