aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2012-12-27 18:07:33 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2012-12-27 18:07:33 +0000
commit797332eda948b694d2e5199869ebd8e748b938db (patch)
tree637fd85a9c4a23ec552c1929931db6848d597935
parent53b0dee13562d7e267c108d7d13580ad6b2b74fe (diff)
downloadgcc-797332eda948b694d2e5199869ebd8e748b938db.zip
gcc-797332eda948b694d2e5199869ebd8e748b938db.tar.gz
gcc-797332eda948b694d2e5199869ebd8e748b938db.tar.bz2
re PR fortran/48976 (INQUIRE with STREAM= not supported)
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. From-SVN: r194733
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/io/inquire.c24
-rw-r--r--libgfortran/io/io.h2
3 files changed, 35 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 04803ec..fa651f9 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 a542334..6dd003c0 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 3b4b34a..43aeafd 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;