[patch,fortran] PR25828 F2003 Stream I/O
Jerry DeLisle
jvdelisle@verizon.net
Thu Aug 10 04:33:00 GMT 2006
:ADDPATCH fortran:
The attached patch is the final version of the stream IO patch. Ready to commit
to 4.2 if approved. This patch includes the INQUIRE (pos= ) capability. It
also incorporates the casts in transfer.c to eliminate warnings that Jack was
seeing.
The streamio_7.f90 test was revised to not use an empty write to position the
file. Though this seems to work on most systems, it does not seem to work on 64
bit platforms. Steve Kargl and I have been beating on that one for about a week
and have decided to open a separate PR for this, since it is a corner case.
streamio_8.f90 is added to test the INQUIRE function.
I also took the opportunity, since I had to add a new pointer type for
GFC_LARGE_IO_INTEGER, to shorten that to GFC_IO_INT. This makes sense since on
systems that do not support large file IO, it is not a LARGE_IO integer.
For consistency, I reordered the ioparm flags. Maybe not necessary, but looks
cleaner.
Regression tested OK. OK to commit to 4.2 only?
If we do this now we won't have to back port it later, it appears safe, and we
should not need to bump the rev on the library.
Regards,
Jerry
2006-08-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25828
* libgfortran.h: Rename GFC_LARGE_IO_INT to GFC_IO_INT.
* io/file_pos.c (st_backspace): Ignore if access=STREAM.
(st_rewind): Handle case of access=STREAM.
* io/open.c (access_opt): Add STREAM_ACCESS.
(edit_modes): Set current_record to zero only if not STREAM.
(new_unit): Initialize maxrec, recl, and last_record for STREAM.
* io/read.c (read_x): Advance file position for STREAM.
* io/io.h (enum unit_access): Align IOPARM flags with frontend.
Add ACCESS_STREAM. Add prototype for is_stream_io () function.
Use GFC_IO_INT.
* io/inquire.c (inquire_via_unit): Add text for access = "STREAM".
* io/unit.c (is_stream_io): New function to return true if access =
STREAM.
* io/transfer.c (file_mode): Add modes for unformatted stream and
formatted stream. (current_mode): Return appropriate file mode based
on access flags.
(read_block): Handle formatted stream reads.
(read_block_direct): Handle unformatted stream reads.
(write_block): Handle formatted stream writes.
(write_buf): Handle unformatted stream writes.
(unformatted_read): Fix up, use temporary for size.
(pre_position): Position file for STREAM access.
(data_transfer_init): Initialize for stream access, skip irrelevent
error checks.
(next_record_r),(next_record_w), and (next_record): Do nothing for
stream I/O.
(finalize_transfer): Flush when all done if stream I/O.
2006-08-09 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/25828
* gfortran.h: Add new pointer for stream position to st_inquire.
Rename gfc_large_io_int_kind to gfc_intio_kind.
* trans-types.c (gfc_init_kinds): use gfc_intio_kind.
* io.c: Add new IO tag for file position going in and another for out.
(match_dt_element): Match new tag_spos.
(gfc_resolve_dt): Resolve new tag_spos.
(gfc_free_inquire): Free inquire->strm_pos.
(match_inquire_element): Match new tag_strm_out.
(gfc_resolve_inquire): Resolve new tag_strm_out.
* trans-io.c: Rename IOPARM_type_large_io_int to IOPARM_type_intio.
(gfc_build_st_parameter): Same.
(gfc_build_io_library_fndecls) Same. and add build pointer type pintio.
(gfc_trans_inquire): Translate strm_pos for inquire.
* ioparm.def: Reorder flags to accomodate addition of new inquire
flag for strm_pos_out and add it in.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr25828-1.diff
Type: text/x-patch
Size: 44175 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_1.f90
Type: text/x-fortran
Size: 454 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_2.f90
Type: text/x-fortran
Size: 475 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_3.f90
Type: text/x-fortran
Size: 552 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_4.f90
Type: text/x-fortran
Size: 961 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_5.f90
Type: text/x-fortran
Size: 689 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_6.f90
Type: text/x-fortran
Size: 1057 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_7.f90
Type: text/x-fortran
Size: 569 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: streamio_8.f90
Type: text/x-fortran
Size: 884 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060810/7b95bec6/attachment-0008.bin>
More information about the Fortran
mailing list