2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Dec 2012 18:07:33 +0000 (18:07 +0000)
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 27 Dec 2012 18:07:33 +0000 (18:07 +0000)
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

libgfortran/ChangeLog
libgfortran/io/inquire.c
libgfortran/io/io.h

index 04803ec..fa651f9 100644 (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
index a542334..6dd003c 100644 (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)
index 3b4b34a..43aeafd 100644 (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;