aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
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