How to implement a couple of PXF routines?

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Aug 5 18:01:00 GMT 2007


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):
> 
> 	call PXFFILENO (iunit, ifildes, ierror)
> 

gfortran has FNUM for compatiability with g77.  The docs say

_Description_:
     `FNUM(UNIT)' returns the POSIX file descriptor number
     corresponding to the open Fortran I/O unit `UNIT'.

_Standard_:
     GNU extension

_Class_:
     Function

_Syntax_:
     `RESULT = FNUM(UNIT)'

_Arguments_:
     UNIT       The type shall be `INTEGER'.

_Return value_:
     The return value is of type `INTEGER'

_Example_:
          program test_fnum
            integer :: i
            open (unit=10, status = "scratch")
            i = fnum(10)
            print *, i
            close (10)
          end program test_fnum

> 2.) PXFFDOPEN - Given an open file descriptor (e.g., from PXFOPEN
>     or PXFCREAT), PXFFDOPEN opens a Fortran logical unit on that FD:
> 
> 	call PXFFDOPEN (ifildes, iunit, access, ierror)
> 

There seems to be no gfortran intrinsic subroutine that matches the
above requirements.

> Is there any interest in getting these routines working with gfortran?

A long time ago, I found a PDF version of POSIX spec on line.  I had 
intended to implement the various routines, but as you can see I 
never had time.  I suspect there is some level of interest in that
the routines would ease the porting of one's code.

-- 
Steve



More information about the Fortran mailing list