This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: How to implement a couple of PXF routines?
- From: Walter Spector <w6ws at earthlink dot net>
- To: fortran at gcc dot gnu dot org
- Date: Tue, 07 Aug 2007 23:19:12 -0700
- Subject: Re: How to implement a couple of PXF routines?
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=Fgqux/d0XTjz+qFhlPDKLlFO13Bnr7omW+EzuFmREWzLZy0tRsb8CTgFQnIQCpnU; h=Received:Message-ID:Date:From:Organization:X-Mailer:X-Accept-Language:MIME-Version:To:Subject:References:Content-Type:Content-Transfer-Encoding:X-ELNK-Trace:X-Originating-IP;
- Organization: Not much.
- References: <46B60585.F5AC1751@earthlink.net> <20070805180054.GA43507@troutmask.apl.washington.edu>
Steve Kargl wrote:
>
> On Sun, Aug 05, 2007 at 10:14:45AM -0700, Walter Spector wrote:
> >
> > 1.) PXFFILENO - Given a Fortran unit 'iunit', return the POSIX file
> > descriptor associated with that unit. If all is well, 0 is returned
> > in ierror. Otherwise ierror returns EINVAL (iunit is not an open unit)
> > or EBADF (iunit is not connected with a file descriptor)...
> gfortran has FNUM for compatiability with g77...
Ok, I took a look at the source. It seems all I have to do is call
unit_to_fd to get the file descriptor. Nice. So PXFFILENO would look
something like:
int unit_to_fd (int fd);
void
pxffileno_ (int *iunit, int *ifildes, int *ierror)
{
*ifildes = unit_to_fd (*iunit);
*ierror = (*ifildes >= 0) ? 0 : EBADF;
}
(Feel free to add it to the gfortran library.)
By the POSIX spec, it would be nice to distinguish between EINVAL and EBADF.
But looking upwards into unit_to_fd and friends, it doesn't look easy enough
to be worth the effort.
Onwards to PXFFDOPEN - but not tonight.
W.