-2007-03-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+2007-09-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/33253
+ * io/write.c (nml_write_obj): Set the delimiter correctly before calling
+ write_character. (namelist_write): Clean up the code a little and add
+ comments to clarify what its doing.
+
+2007-09-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33225
* io/write.c (stdbool.h): Add include. (sign_t): Move typedef to
size_t base_name_len;
size_t base_var_name_len;
size_t tot_len;
+ unit_delim tmp_delim;
/* Write namelist variable names in upper case. If a derived type,
nothing is output. If a component, base and base_name are set. */
break;
case GFC_DTYPE_CHARACTER:
- if (dtp->u.p.nml_delim)
- write_character (dtp, &dtp->u.p.nml_delim, 1);
+ tmp_delim = dtp->u.p.current_unit->flags.delim;
+ if (dtp->u.p.nml_delim == '"')
+ dtp->u.p.current_unit->flags.delim = DELIM_QUOTE;
+ if (dtp->u.p.nml_delim == '\'')
+ dtp->u.p.current_unit->flags.delim = DELIM_APOSTROPHE;
write_character (dtp, p, obj->string_length);
- if (dtp->u.p.nml_delim)
- write_character (dtp, &dtp->u.p.nml_delim, 1);
+ dtp->u.p.current_unit->flags.delim = tmp_delim;
break;
case GFC_DTYPE_REAL:
/* Set the delimiter for namelist output. */
tmp_delim = dtp->u.p.current_unit->flags.delim;
- dtp->u.p.current_unit->flags.delim = DELIM_NONE;
switch (tmp_delim)
{
case (DELIM_QUOTE):
break;
}
+ /* Temporarily disable namelist delimters. */
+ dtp->u.p.current_unit->flags.delim = DELIM_NONE;
+
write_character (dtp, "&", 1);
/* Write namelist name in upper case - f95 std. */
-
for (i = 0 ;i < dtp->namelist_name_len ;i++ )
{
c = toupper (dtp->namelist_name[i]);
t1 = nml_write_obj (dtp, t2, dummy_offset, dummy, dummy_name);
}
}
+
#ifdef HAVE_CRLF
write_character (dtp, " /\r\n", 5);
#else
write_character (dtp, " /\n", 4);
#endif
- /* Recover the original delimiter. */
-
+ /* Restore the original delimiter. */
dtp->u.p.current_unit->flags.delim = tmp_delim;
}