diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-27 18:07:33 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-27 18:07:33 +0000 |
commit | 983e427ef9f657b66367adb986cd48bbe1c2d829 (patch) | |
tree | 637fd85a9c4a23ec552c1929931db6848d597935 /libgfortran | |
parent | dc9c6abef5a100822bec23e9dbd753629d5278b3 (diff) | |
download | gcc-983e427ef9f657b66367adb986cd48bbe1c2d829.tar.gz |
2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/48976
* io/inquire.c (inquire_via_unit): Set user stream inquiry variable to
appropriate value based on unit access method. (inquire_via_filename):
Since filename is not associated with an open unit, set stream inquiry
to UNKNOWN.
* io/io.h: Define inquire stream parameters.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194733 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 9 | ||||
-rw-r--r-- | libgfortran/io/inquire.c | 24 | ||||
-rw-r--r-- | libgfortran/io/io.h | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 04803ec28d6..fa651f9264c 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,12 @@ +2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/48976 + * io/inquire.c (inquire_via_unit): Set user stream inquiry variable to + appropriate value based on unit access method. (inquire_via_filename): + Since filename is not associated with an open unit, set stream inquiry + to UNKNOWN. + * io/io.h: Define inquire stream parameters. + 2012-12-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/48960 diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c index a5423346db9..6dd003c01aa 100644 --- a/libgfortran/io/inquire.c +++ b/libgfortran/io/inquire.c @@ -414,6 +414,27 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) *iqp->size = ssize (u->s); } } + + if ((cf2 & IOPARM_INQUIRE_HAS_IQSTREAM) != 0) + { + if (u == NULL) + p = "UNKNOWN"; + else + switch (u->flags.access) + { + case ACCESS_SEQUENTIAL: + case ACCESS_DIRECT: + p = "NO"; + break; + case ACCESS_STREAM: + p = "YES"; + break; + default: + internal_error (&iqp->common, "inquire_via_unit(): Bad pad"); + } + + cf_strcpy (iqp->iqstream, iqp->iqstream_len, p); + } } if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0) @@ -659,6 +680,9 @@ inquire_via_filename (st_parameter_inquire *iqp) if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0) *iqp->size = file_size (iqp->file, iqp->file_len); + + if ((cf2 & IOPARM_INQUIRE_HAS_IQSTREAM) != 0) + cf_strcpy (iqp->iqstream, iqp->iqstream_len, "UNKNOWN"); } if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0) diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index 3b4b34a16f8..43aeafd2e63 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -293,6 +293,7 @@ st_parameter_filepos; #define IOPARM_INQUIRE_HAS_PENDING (1 << 5) #define IOPARM_INQUIRE_HAS_SIZE (1 << 6) #define IOPARM_INQUIRE_HAS_ID (1 << 7) +#define IOPARM_INQUIRE_HAS_IQSTREAM (1 << 8) typedef struct { @@ -326,6 +327,7 @@ typedef struct GFC_INTEGER_4 *pending; GFC_IO_INT *size; GFC_INTEGER_4 *id; + CHARACTER1 (iqstream); } st_parameter_inquire; |