ASM allowed in Fortran? and OpenDir?

Walter Spector w6ws@earthlink.net
Wed Aug 8 17:20:00 GMT 2007


Hi again,

FX Coudert wrote:
> 
> >     integer :: dirid
> >     integer :: jdirent
> >     integer :: pxferr
> >
> >     call pxfopendir (mydir, len (mydir), dirid, pxferr)
> 
> This assumes that the directory id can fit in an integer, which might
> be an issue for 64bit platforms, isn't it?

To further clarify:

The dirid is a 'directory stream' number - which is returned by the
OS for use by (pxf)readdir.  When finished, the stream can then be
recycled via (pxf)closedir.  It should be some small ordinal - similar
to how the POSIX file descriptors work.

It is unlikely that an application would have more than 2^31 directory
streams open simultaneously.  I suspect such an application would have
run out of other resources first!

Janne Blomqvist then wrote:
> struct dirent
>   {
> #ifndef __USE_FILE_OFFSET64
>     __ino_t d_ino;
>     __off_t d_off;
> #else
>     __ino64_t d_ino;
>     __off64_t d_off;
> #endif
>     unsigned short int d_reclen;
>     unsigned char d_type;
>     char d_name[256];           /* We must not include limits.h! */
>   };

Two things to note about the dirent struct and PXF:

1.) The 1003.9-1992 Standard only requires access to one field - d_name,
which is a string.  There is no requirement for access to d_ino or d_off.

2.) It is trivial to extend PXFINTGET to access d_ino or d_off.  But the issue
of fields larger than 'default integer' kind (e.g., 32 bits), is certainly
valid.  For this case, Intel and others have implemented a PXFINT8GET variant
which can return a 64-bit value.  And, inversely, a PXFINT8SET variant to
insert 64-bit values into the struct.

W.



More information about the Fortran mailing list