aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jblomqvi@cc.hut.fi>2005-09-26 23:24:45 +0300
committerBud Davis <bdavis@gcc.gnu.org>2005-09-26 20:24:45 +0000
commit18623faed15aed3cc1ecbca0e7323bbc02b4d44b (patch)
tree1d8a8fc9695ef85e44fe907a795461636d663eb7 /libgfortran/io/write.c
parentd05d9ac771ec6e7f7a1f0f0417106b0c73a9943d (diff)
downloadgcc-18623faed15aed3cc1ecbca0e7323bbc02b4d44b.zip
gcc-18623faed15aed3cc1ecbca0e7323bbc02b4d44b.tar.gz
gcc-18623faed15aed3cc1ecbca0e7323bbc02b4d44b.tar.bz2
[multiple changes]
2005-09-24 Janne Blomqvist <jblomqvi@cc.hut.fi> * trans-io.c (gfc_build_io_library_fndecls): Add entry iocall_x_array for transfer_array. (transfer_array_desc): New function. (gfc_trans_transfer): Add code to call transfer_array_desc. 2005-09-24 Janne Blomqvist <jblomqvi@cc.hut.fi> * io.h: Changed prototypes of list_formatted_{read|write}. * list_read.c (list_formatted_read): Renamed to list_formatted_read_scalar and made static. (list_formatted_read): New function. * transfer.c: Prototype for transfer_array. Changed transfer function pointer. (unformatted_read): Add nelems argument, use it. (unformatted_write): Likewise. (formatted_transfer): Changed name to formatted_transfer_scalar. (formatted_transfer): New function. (transfer_integer): Add nelems argument to transfer call, move updating item count to transfer functions. (transfer_real): Likewise. (transfer_logical): Likewise. (transfer_character): Likewise. (transfer_complex): Likewise. (transfer_array): New function. (data_transfer_init): Call formatted_transfer with new argument. (iolength_transfer): New argument, use it. * write.c (list_formatted_write): Renamed to list_formatted_write_scalar, made static. (list_formatted_write): New function. From-SVN: r104662
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index da9feb3..0436134 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1423,8 +1423,8 @@ write_separator (void)
TODO: handle skipping to the next record correctly, particularly
with strings. */
-void
-list_formatted_write (bt type, void *p, int len)
+static void
+list_formatted_write_scalar (bt type, void *p, int len)
{
static int char_flag;
@@ -1468,6 +1468,29 @@ list_formatted_write (bt type, void *p, int len)
char_flag = (type == BT_CHARACTER);
}
+
+void
+list_formatted_write (bt type, void *p, int len, size_t nelems)
+{
+ size_t elem;
+ int size;
+ char *tmp;
+
+ tmp = (char *) p;
+
+ if (type == BT_COMPLEX)
+ size = 2 * len;
+ else
+ size = len;
+
+ /* Big loop over all the elements. */
+ for (elem = 0; elem < nelems; elem++)
+ {
+ g.item_count++;
+ list_formatted_write_scalar (type, tmp + size*elem, len);
+ }
+}
+
/* NAMELIST OUTPUT
nml_write_obj writes a namelist object to the output stream. It is called