diff options
Diffstat (limited to 'libgfortran/io/transfer.c')
-rw-r--r-- | libgfortran/io/transfer.c | 51 |
1 files changed, 51 insertions, 0 deletions
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 |