aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJanne Blomqvist <jblomqvi@cc.hut.fi>2004-06-22 03:43:55 +0300
committerPaul Brook <pbrook@gcc.gnu.org>2004-06-22 00:43:55 +0000
commit8750f9cdec153095cc47c41b887bc86fda4a0e3e (patch)
treeceecaee98023a95b8e6865056ce0fa2cc4afb927 /libgfortran
parent88c499cce7487e1d4b40e8c7d568db22ba59d90e (diff)
downloadgcc-8750f9cdec153095cc47c41b887bc86fda4a0e3e.zip
gcc-8750f9cdec153095cc47c41b887bc86fda4a0e3e.tar.gz
gcc-8750f9cdec153095cc47c41b887bc86fda4a0e3e.tar.bz2
re PR fortran/15750 (IOLENGTH form of INQUIRE statement not implemented)
PR fortran/15750 * io.c (gfc_match_inquire): Bugfix for iolength related stuff. (gfc_resolve_inquire): Resolve the iolength tag. Return SUCCESS at end of function if no failure has occured. * resolve.c (resolve_code): Resolve if iolength is encountered. * trans-io.c: (ioparm_iolength, iocall_iolength, iocall_iolength_done): New variables. (last_dt): Add IOLENGTH. (gfc_build_io_library_fndecls ): Set iolength related variables. (gfc_trans_iolength): Implement. (gfc_trans_dt_end): Treat iolength as a third form of data transfer. libgfortran/ PR fortran/15750 * inquire.c (st_inquire): Add comment * io.h (st_parameter): Add iolength. (st_iolength, st_iolength_done): Declare. * transfer.c (iolength_transfer, iolength_transfer_init, st_iolength, st_iolength_done): New functions. testsuite/ * gfortran.fortran-torture/execute/iolength_1.f90: New test. * gfortran.fortran-torture/execute/iolength_3.f90: New test. From-SVN: r83472
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog9
-rw-r--r--libgfortran/io/inquire.c2
-rw-r--r--libgfortran/io/io.h4
-rw-r--r--libgfortran/io/transfer.c51
4 files changed, 66 insertions, 0 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 107f903..933187a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,12 @@
+2004-06-22 Janne Blomqvist <jblomqvi@cc.hut.fi>
+
+ PR fortran/15750
+ * inquire.c (st_inquire): Add comment
+ * io.h (st_parameter): Add iolength.
+ (st_iolength, st_iolength_done): Declare.
+ * transfer.c (iolength_transfer, iolength_transfer_init,
+ st_iolength, st_iolength_done): New functions.
+
2004-06-21 Steven G. Kargl <kargls@comcast.net>
* etime.c (etime_sub): Remove array rank check;
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 20bea1f..36957dd 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -348,6 +348,8 @@ inquire_via_filename (void)
}
+/* Library entry point for the INQUIRE statement (non-IOLENGTH
+ form). */
void
st_inquire (void)
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 7658ec8..8ad2599 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -177,6 +177,8 @@ typedef struct
int recl_in;
int *recl_out;
+ int *iolength;
+
char *file;
int file_len;
char *status;
@@ -642,6 +644,8 @@ void list_formatted_write (bt, void *, int);
#define st_open prefix(st_open)
#define st_close prefix(st_close)
#define st_inquire prefix(st_inquire)
+#define st_iolength prefix(st_iolength)
+#define st_iolength_done prefix(st_iolength_done)
#define st_rewind prefix(st_rewind)
#define st_read prefix(st_read)
#define st_read_done prefix(st_read_done)
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 04b7c5a..b20f860 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -1361,6 +1361,57 @@ finalize_transfer (void)
}
+/* Transfer function for IOLENGTH. It doesn't actually do any
+ data transfer, it just updates the length counter. */
+
+static void
+iolength_transfer (bt type, void *dest, int len)
+{
+ if (ioparm.iolength != NULL)
+ *ioparm.iolength += len;
+}
+
+
+/* Initialize the IOLENGTH data transfer. This function is in essence
+ a very much simplified version of data_transfer_init(), because it
+ doesn't have to deal with units at all. */
+
+static void
+iolength_transfer_init (void)
+{
+
+ if (ioparm.iolength != NULL)
+ *ioparm.iolength = 0;
+
+ g.item_count = 0;
+
+ /* Set up the subroutine that will handle the transfers. */
+
+ transfer = iolength_transfer;
+
+}
+
+
+/* Library entry point for the IOLENGTH form of the INQUIRE
+ statement. The IOLENGTH form requires no I/O to be performed, but
+ it must still be a runtime library call so that we can determine
+ the iolength for dynamic arrays and such. */
+
+void
+st_iolength (void)
+{
+ library_start ();
+
+ iolength_transfer_init ();
+}
+
+void
+st_iolength_done (void)
+{
+ library_end ();
+}
+
+
/* The READ statement */
void