Named Pipe unformatted I/O (PR30162)

Jerry DeLisle jvdelisle@verizon.net
Mon Jan 1 18:23:00 GMT 2007


All,

I have presented a simple patch to handle FORM="formatted" for Thomas to test.

For ACCESS="direct" and ACCESS="stream" with POS= I plan to test for named pipes 
and issue an error.

As you may know, FORM="unformatted" is much trickier.  I have a couple of ideas:

Keep in mind that right now for a write statement such as:

WRITE(10) var1, var2, var3

The record size is sizeof(var1) + sizeof(var2) + sizeof(var3)

we build a set of calls to the library like this:

st_write
transfer var1
transfer var2
transfer var3
st_write_done

Record size is currently determined by accumulating the iolengths as we go, 
forcing us to seek back in the file and fill in the starting record marker.

Idea 1) We could modify the frontend to include a call to test for named pipes 
and setup the calls to run through the transfers between st_write and 
st_write_done with two passes.  At run time, if the file is not a named pipe, we 
skip the first pass, otherwise we proceed with the first pass similar to INQUIRE 
with IOLENGTH= and we determine the record size. The second pass then uses the 
record size determined to just do the transfers without any seeking back to fill 
in the starting record number.

Idea 2) In the frontend, actually build a linked list of the READ or WRITE 
output list that would allow easy scanning through the list to compute the 
record size.  Obviously, the output list is in the frontend already (in some 
form), so maybe all we do is pass that list to the library for a special call to 
a new function "get_record_length" and then use that record length.  This 
approach would clean up some of the bean counting going on in the transfer 
routines now.  The library could also go through the list and decide which 
transfer calls to make or leave it as is in the frontend to save runtime overhead.

Other suggestions?  (I am leaning toward 2)

Regards,

Jerry



More information about the Fortran mailing list