ASM allowed in Fortran? and OpenDir?

Walter Spector w6ws@earthlink.net
Wed Aug 8 11:46:00 GMT 2007


Janne Blomqvist wrote:
> 
> On 8/8/07, FX Coudert <fxcoudert@gmail.com> 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?

It depends on the size of your integer.  PXF specifies the default-sized
integer because that is all the Fortran-77 (and -90/95/2003 for that matter)
Standard requires.  And yes, these days that usually means 32 bits.

> Not just 64-bit platforms, any systems with LFS, which includes pretty
> much everything released within the last 5 years... Of course, when you do
> hit that bug it'll be one of those infuriating "works on system A and
> not on system B, although they have identical software"...

A quality implementation would detect that the integer size has
been exceeded, and return ETRUNC in the IERROR argument.  This would
at least allow the caller to know that there is a problem.

> ... I suppose supporting even a withdrawn
> standard would be better than nothing, but the contortions PXF* goes
> through to access C from F77 looks rather painful. Some F90+-iy
> interface making use of derived types would surely be much nicer (I
> suppose PXF90 doesn't exist?).

It really isn't that painful.  The steps are identical to what one
would use in C.

That said, I agree that it would have been nice to have a 'PXF90'.
There are several badly needed extensions - which I made in my private
version.  Two are pxfint8get - which returns 8 byte fields (and is compatible
with the Intel and IRIX extension of the same name), and pxfstrerror - which
returns a string describing a given errno.  I also support symbolic links,
a pxfsystem, and a few other things.

Interestingly, I have not felt an extreme need for derived types.
The problem, again, is that if one has a module with derived
types defined in it, there is no way to automagically extract the proper
layout from the master definitions in the C headers.  You end up with a lot
of conditional code, multiple versions, porting problems, etc.  The only
way I know to avoid this is to write a pxfstructcreate-like routine in C.
But if one is going to go that far, why not just write pxfstructcreate and
be done with it?

W.



More information about the Fortran mailing list