diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-15 23:06:44 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-08-15 23:06:44 +0000 |
commit | 4d8ee55b7d3fd31406d095afb53a1fac983490c6 (patch) | |
tree | a00eb1bf11f7cace4d681ea98e21b7e72e529de0 /libgfortran/io/open.c | |
parent | e83964b23af081bec09add65a9ab27772c729bad (diff) | |
download | gcc-4d8ee55b7d3fd31406d095afb53a1fac983490c6.tar.gz |
2006-08-15 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116172 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/io/open.c')
-rw-r--r-- | libgfortran/io/open.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 3515bef75ce..b3360792a22 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -40,6 +40,7 @@ static const st_option access_opt[] = { {"sequential", ACCESS_SEQUENTIAL}, {"direct", ACCESS_DIRECT}, {"append", ACCESS_APPEND}, + {"stream", ACCESS_STREAM}, {NULL, 0} }; @@ -214,7 +215,9 @@ edit_modes (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) if (sseek (u->s, file_length (u->s)) == FAILURE) goto seek_error; - u->current_record = 0; + if (flags->access != ACCESS_STREAM) + u->current_record = 0; + u->endfile = AT_ENDFILE; /* We are at the end. */ break; @@ -432,6 +435,13 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags) if (flags->access == ACCESS_DIRECT) u->maxrec = max_offset / u->recl; + + if (flags->access == ACCESS_STREAM) + { + u->maxrec = max_offset; + u->recl = 1; + u->last_record = 1; + } memmove (u->file, opp->file, opp->file_len); u->file_len = opp->file_len; |