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
This commit is contained in:
Jerry DeLisle 2012-12-27 18:07:33 +00:00
parent 53b0dee135
commit 797332eda9
3 changed files with 35 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -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;