Commit 797332ed by Jerry DeLisle

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
parent 53b0dee1
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> 2012-12-26 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/48960 PR libfortran/48960
......
...@@ -414,6 +414,27 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u) ...@@ -414,6 +414,27 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
*iqp->size = ssize (u->s); *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) if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
...@@ -659,6 +680,9 @@ inquire_via_filename (st_parameter_inquire *iqp) ...@@ -659,6 +680,9 @@ inquire_via_filename (st_parameter_inquire *iqp)
if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0) if ((cf2 & IOPARM_INQUIRE_HAS_SIZE) != 0)
*iqp->size = file_size (iqp->file, iqp->file_len); *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) if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
......
...@@ -293,6 +293,7 @@ st_parameter_filepos; ...@@ -293,6 +293,7 @@ st_parameter_filepos;
#define IOPARM_INQUIRE_HAS_PENDING (1 << 5) #define IOPARM_INQUIRE_HAS_PENDING (1 << 5)
#define IOPARM_INQUIRE_HAS_SIZE (1 << 6) #define IOPARM_INQUIRE_HAS_SIZE (1 << 6)
#define IOPARM_INQUIRE_HAS_ID (1 << 7) #define IOPARM_INQUIRE_HAS_ID (1 << 7)
#define IOPARM_INQUIRE_HAS_IQSTREAM (1 << 8)
typedef struct typedef struct
{ {
...@@ -326,6 +327,7 @@ typedef struct ...@@ -326,6 +327,7 @@ typedef struct
GFC_INTEGER_4 *pending; GFC_INTEGER_4 *pending;
GFC_IO_INT *size; GFC_IO_INT *size;
GFC_INTEGER_4 *id; GFC_INTEGER_4 *id;
CHARACTER1 (iqstream);
} }
st_parameter_inquire; st_parameter_inquire;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment