+2008-09-25 Jerry DeLisle <jvdelisle@gcc.gnu.org
+
+ PR libfortran/37498
+ * list_read.c (eat_separator): Revert previous patch and move
+ delim_status, decimal_status, and pad_status to gfc_unit.
+ (parse_real): Ditto. (read_real): Ditto.
+ * read.c (read_a): Likewise. (read_a_char4): Likewise.
+ (read_f): Likewise.
+ * inquire.c (inquire_via_unit): Add missing check for
+ IOPARM_INQUIRE_HAS_FLAGS2. (inquire_via_filename): Likewise.
+ * io.h (unit_sign_s): Move delim_status, decimal_status, and pad_status
+ to gfc_unit.
+ * transfer.c (read_sf): Ditto. (read_block_form): Ditto.
+ (formatted_transfer_scalar): Ditto. (data_transfer_init): Ditto.
+ * write.c (write_default_char4): Ditto. (write_utf8_char4): Ditto.
+ (write_character): Ditto. (write_real_g0): Ditto.
+ (list_formatted_write_scalar): Ditto. (nml_write_obj): Ditto.
+ (namelist_write): Ditto.
+ * write_float.def (calculate_sign): Ditto. (output_float): Ditto.
+
2008-09-24 Tobias Burnus <burnus@net-b.de>
* runtime/compile_options.c (init_compile_options):
cf_strcpy (iqp->pad, iqp->pad_len, p);
}
- if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0)
- *iqp->pending = 0;
-
- if ((cf2 & IOPARM_INQUIRE_HAS_ID) != 0)
- *iqp->id = 0;
-
- if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
+ if (cf & IOPARM_INQUIRE_HAS_FLAGS2)
{
- if (u == NULL || u->flags.form != FORM_FORMATTED)
- p = undefined;
- else
- switch (u->flags.encoding)
- {
- case ENCODING_DEFAULT:
- p = "UNKNOWN";
- break;
- case ENCODING_UTF8:
- p = "UTF-8";
- break;
- default:
- internal_error (&iqp->common, "inquire_via_unit(): Bad encoding");
- }
-
- cf_strcpy (iqp->encoding, iqp->encoding_len, p);
- }
-
- if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0)
- {
- if (u == NULL || u->flags.form != FORM_FORMATTED)
- p = undefined;
- else
- switch (u->flags.decimal)
- {
- case DECIMAL_POINT:
- p = "POINT";
- break;
- case DECIMAL_COMMA:
- p = "COMMA";
- break;
- default:
- internal_error (&iqp->common, "inquire_via_unit(): Bad comma");
- }
-
- cf_strcpy (iqp->decimal, iqp->decimal_len, p);
- }
-
- if ((cf2 & IOPARM_INQUIRE_HAS_ASYNCHRONOUS) != 0)
- {
- if (u == NULL)
- p = undefined;
- else
- switch (u->flags.async)
- {
- case ASYNC_YES:
- p = "YES";
- break;
- case ASYNC_NO:
- p = "NO";
- break;
- default:
- internal_error (&iqp->common, "inquire_via_unit(): Bad async");
- }
+ if ((cf2 & IOPARM_INQUIRE_HAS_PENDING) != 0)
+ *iqp->pending = 0;
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_ID) != 0)
+ *iqp->id = 0;
- cf_strcpy (iqp->asynchronous, iqp->asynchronous_len, p);
- }
+ if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
+ {
+ if (u == NULL || u->flags.form != FORM_FORMATTED)
+ p = undefined;
+ else
+ switch (u->flags.encoding)
+ {
+ case ENCODING_DEFAULT:
+ p = "UNKNOWN";
+ break;
+ case ENCODING_UTF8:
+ p = "UTF-8";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad encoding");
+ }
+
+ cf_strcpy (iqp->encoding, iqp->encoding_len, p);
+ }
- if ((cf2 & IOPARM_INQUIRE_HAS_SIGN) != 0)
- {
- if (u == NULL)
- p = undefined;
- else
- switch (u->flags.sign)
- {
- case SIGN_PROCDEFINED:
- p = "PROCESSOR_DEFINED";
- break;
- case SIGN_SUPPRESS:
- p = "SUPPRESS";
- break;
- case SIGN_PLUS:
- p = "PLUS";
- break;
- default:
- internal_error (&iqp->common, "inquire_via_unit(): Bad sign");
- }
+ if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0)
+ {
+ if (u == NULL || u->flags.form != FORM_FORMATTED)
+ p = undefined;
+ else
+ switch (u->flags.decimal)
+ {
+ case DECIMAL_POINT:
+ p = "POINT";
+ break;
+ case DECIMAL_COMMA:
+ p = "COMMA";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad comma");
+ }
+
+ cf_strcpy (iqp->decimal, iqp->decimal_len, p);
+ }
- cf_strcpy (iqp->sign, iqp->sign_len, p);
- }
+ if ((cf2 & IOPARM_INQUIRE_HAS_ASYNCHRONOUS) != 0)
+ {
+ if (u == NULL)
+ p = undefined;
+ else
+ switch (u->flags.async)
+ {
+ case ASYNC_YES:
+ p = "YES";
+ break;
+ case ASYNC_NO:
+ p = "NO";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad async");
+ }
+
+ cf_strcpy (iqp->asynchronous, iqp->asynchronous_len, p);
+ }
- if ((cf2 & IOPARM_INQUIRE_HAS_ROUND) != 0)
- {
- if (u == NULL)
- p = undefined;
- else
- switch (u->flags.round)
- {
- case ROUND_UP:
- p = "UP";
- break;
- case ROUND_DOWN:
- p = "DOWN";
- break;
- case ROUND_ZERO:
- p = "ZERO";
- break;
- case ROUND_NEAREST:
- p = "NEAREST";
- break;
- case ROUND_COMPATIBLE:
- p = "COMPATIBLE";
- break;
- case ROUND_PROCDEFINED:
- p = "PROCESSOR_DEFINED";
- break;
- default:
- internal_error (&iqp->common, "inquire_via_unit(): Bad round");
- }
+ if ((cf2 & IOPARM_INQUIRE_HAS_SIGN) != 0)
+ {
+ if (u == NULL)
+ p = undefined;
+ else
+ switch (u->flags.sign)
+ {
+ case SIGN_PROCDEFINED:
+ p = "PROCESSOR_DEFINED";
+ break;
+ case SIGN_SUPPRESS:
+ p = "SUPPRESS";
+ break;
+ case SIGN_PLUS:
+ p = "PLUS";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad sign");
+ }
+
+ cf_strcpy (iqp->sign, iqp->sign_len, p);
+ }
- cf_strcpy (iqp->round, iqp->round_len, p);
+ if ((cf2 & IOPARM_INQUIRE_HAS_ROUND) != 0)
+ {
+ if (u == NULL)
+ p = undefined;
+ else
+ switch (u->flags.round)
+ {
+ case ROUND_UP:
+ p = "UP";
+ break;
+ case ROUND_DOWN:
+ p = "DOWN";
+ break;
+ case ROUND_ZERO:
+ p = "ZERO";
+ break;
+ case ROUND_NEAREST:
+ p = "NEAREST";
+ break;
+ case ROUND_COMPATIBLE:
+ p = "COMPATIBLE";
+ break;
+ case ROUND_PROCDEFINED:
+ p = "PROCESSOR_DEFINED";
+ break;
+ default:
+ internal_error (&iqp->common, "inquire_via_unit(): Bad round");
+ }
+
+ cf_strcpy (iqp->round, iqp->round_len, p);
+ }
}
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
if ((cf & IOPARM_INQUIRE_HAS_PAD) != 0)
cf_strcpy (iqp->pad, iqp->pad_len, undefined);
- if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
- cf_strcpy (iqp->encoding, iqp->encoding_len, undefined);
+ if (cf & IOPARM_INQUIRE_HAS_FLAGS2)
+ {
+ if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
+ cf_strcpy (iqp->encoding, iqp->encoding_len, undefined);
- if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0)
- cf_strcpy (iqp->delim, iqp->delim_len, undefined);
+ if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0)
+ cf_strcpy (iqp->delim, iqp->delim_len, undefined);
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0)
+ cf_strcpy (iqp->decimal, iqp->decimal_len, undefined);
- if ((cf2 & IOPARM_INQUIRE_HAS_DECIMAL) != 0)
- cf_strcpy (iqp->decimal, iqp->decimal_len, undefined);
+ if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0)
+ cf_strcpy (iqp->delim, iqp->delim_len, undefined);
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_PAD) != 0)
+ cf_strcpy (iqp->pad, iqp->pad_len, undefined);
+
+ if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
+ cf_strcpy (iqp->encoding, iqp->encoding_len, undefined);
+ }
if ((cf & IOPARM_INQUIRE_HAS_POSITION) != 0)
cf_strcpy (iqp->position, iqp->position_len, undefined);
p = inquire_read (iqp->file, iqp->file_len);
cf_strcpy (iqp->readwrite, iqp->readwrite_len, p);
}
-
- if ((cf2 & IOPARM_INQUIRE_HAS_DELIM) != 0)
- cf_strcpy (iqp->delim, iqp->delim_len, undefined);
-
- if ((cf2 & IOPARM_INQUIRE_HAS_PAD) != 0)
- cf_strcpy (iqp->pad, iqp->pad_len, undefined);
-
- if ((cf2 & IOPARM_INQUIRE_HAS_ENCODING) != 0)
- cf_strcpy (iqp->encoding, iqp->encoding_len, undefined);
}
kind. */
char value[32];
gfc_offset size_used;
- unit_pad pad_status;
- unit_decimal decimal_status;
- unit_delim delim_status;
} st_parameter_44;
typedef struct st_parameter_dt
unit_mode mode;
unit_flags flags;
+ unit_pad pad_status;
+ unit_decimal decimal_status;
+ unit_delim delim_status;
/* recl -- Record length of the file.
last_record -- Last record number read or written
switch (c)
{
case ',':
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
{
unget_char (dtp, c);
break;
default:
if (dtp->u.p.namelist_mode)
{
- if (dtp->u.p.delim_status == DELIM_APOSTROPHE
- || dtp->u.p.delim_status == DELIM_QUOTE
+ if (dtp->u.p.current_unit->delim_status == DELIM_APOSTROPHE
+ || dtp->u.p.current_unit->delim_status == DELIM_QUOTE
|| c == '&' || c == '$' || c == '/')
{
unget_char (dtp, c);
c = next_char (dtp);
}
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
if (!isdigit (c) && c != '.')
for (;;)
{
c = next_char (dtp);
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
switch (c)
{
else
unget_char (dtp, c);
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- {
- if (next_char (dtp)
- != (dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';'))
- goto bad_complex;
- }
- else
- {
- if (next_char (dtp) != ',')
- goto bad_complex;
- }
+ if (next_char (dtp)
+ != (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';'))
+ goto bad_complex;
eol_2:
eat_spaces (dtp);
seen_dp = 0;
c = next_char (dtp);
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
switch (c)
{
for (;;)
{
c = next_char (dtp);
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
switch (c)
{
c = next_char (dtp);
}
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
if (!isdigit (c) && c != '.')
for (;;)
{
c = next_char (dtp);
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && c == ',' && dtp->u.p.decimal_status == DECIMAL_COMMA)
+ if (c == ',' && dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA)
c = '.';
switch (c)
{
else
read_default_char1 (dtp, p, length, w);
- dtp->u.p.sf_read_comma = 1;
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- dtp->u.p.sf_read_comma = dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1;
+ dtp->u.p.sf_read_comma =
+ dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;
}
else
read_default_char4 (dtp, p, length, w);
- dtp->u.p.sf_read_comma = 1;
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- dtp->u.p.sf_read_comma = dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1;
+ dtp->u.p.sf_read_comma =
+ dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;
}
/* eat_leading_spaces()-- Given a character pointer and a width,
switch (*p)
{
case ',':
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && (dtp->u.p.decimal_status == DECIMAL_COMMA && *p == ','))
- *p = '.';
+ if (dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA
+ && *p == ',')
+ *p = '.';
else
goto bad_float;
/* Fall through */
void
read_x (st_parameter_dt * dtp, int n)
{
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- {
- if ((dtp->u.p.pad_status == PAD_NO || is_internal_unit (dtp))
- && dtp->u.p.current_unit->bytes_left < n)
- n = dtp->u.p.current_unit->bytes_left;
- }
- else
- {
- if (is_internal_unit (dtp) && dtp->u.p.current_unit->bytes_left < n)
- n = dtp->u.p.current_unit->bytes_left;
- }
+ if ((dtp->u.p.current_unit->pad_status == PAD_NO || is_internal_unit (dtp))
+ && dtp->u.p.current_unit->bytes_left < n)
+ n = dtp->u.p.current_unit->bytes_left;
dtp->u.p.sf_read_comma = 0;
if (n > 0)
/* Without padding, terminate the I/O statement without assigning
the value. With padding, the value still needs to be assigned,
so we can just continue with a short read. */
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && dtp->u.p.pad_status == PAD_NO)
+ if (dtp->u.p.current_unit->pad_status == PAD_NO)
{
if (no_error)
break;
dtp->u.p.current_unit->bytes_left = dtp->u.p.current_unit->recl;
else
{
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && dtp->u.p.pad_status == PAD_NO)
+ if (dtp->u.p.current_unit->pad_status == PAD_NO)
{
/* Not enough data left. */
generate_error (&dtp->common, LIBERROR_EOR, NULL);
if (nread != *nbytes)
{ /* Short read, this shouldn't happen. */
- if ((dtp->common.flags & IOPARM_DT_HAS_F2003)
- && dtp->u.p.pad_status == PAD_YES)
+ if (dtp->u.p.current_unit->pad_status == PAD_YES)
*nbytes = nread;
else
{
/* Set this flag so that commas in reads cause the read to complete before
the entire field has been read. The next read field will start right after
the comma in the stream. (Set to 0 for character reads). */
- dtp->u.p.sf_read_comma = 1;
-
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- dtp->u.p.sf_read_comma = dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1;
+ dtp->u.p.sf_read_comma =
+ dtp->u.p.current_unit->decimal_status == DECIMAL_COMMA ? 0 : 1;
dtp->u.p.line_buffer = scratch;
case FMT_DC:
consume_data_flag = 0;
- dtp->u.p.decimal_status = DECIMAL_COMMA;
+ dtp->u.p.current_unit->decimal_status = DECIMAL_COMMA;
break;
case FMT_DP:
consume_data_flag = 0;
- dtp->u.p.decimal_status = DECIMAL_POINT;
+ dtp->u.p.current_unit->decimal_status = DECIMAL_POINT;
break;
case FMT_P:
if (dtp->u.p.advance_status == ADVANCE_UNSPECIFIED)
dtp->u.p.advance_status = ADVANCE_YES;
- /* To maintain ABI check these only if we have the F2003 flag set. */
- if(cf & IOPARM_DT_HAS_F2003)
- {
- /* Check the decimal mode. */
- dtp->u.p.decimal_status
+ /* Check the decimal mode. */
+ dtp->u.p.current_unit->decimal_status
= !(cf & IOPARM_DT_HAS_DECIMAL) ? DECIMAL_UNSPECIFIED :
find_option (&dtp->common, dtp->u.p.decimal, dtp->u.p.decimal_len,
decimal_opt, "Bad DECIMAL parameter in data transfer "
"statement");
- if (dtp->u.p.decimal_status == DECIMAL_UNSPECIFIED)
- dtp->u.p.decimal_status = dtp->u.p.current_unit->flags.decimal;
+ if (dtp->u.p.current_unit->decimal_status == DECIMAL_UNSPECIFIED)
+ dtp->u.p.current_unit->decimal_status = dtp->u.p.current_unit->flags.decimal;
- /* Check the sign mode. */
- dtp->u.p.sign_status
+ /* Check the sign mode. */
+ dtp->u.p.sign_status
= !(cf & IOPARM_DT_HAS_SIGN) ? SIGN_UNSPECIFIED :
find_option (&dtp->common, dtp->u.p.sign, dtp->u.p.sign_len, sign_opt,
"Bad SIGN parameter in data transfer statement");
- if (dtp->u.p.sign_status == SIGN_UNSPECIFIED)
+ if (dtp->u.p.sign_status == SIGN_UNSPECIFIED)
dtp->u.p.sign_status = dtp->u.p.current_unit->flags.sign;
- /* Check the blank mode. */
- dtp->u.p.blank_status
+ /* Check the blank mode. */
+ dtp->u.p.blank_status
= !(cf & IOPARM_DT_HAS_BLANK) ? BLANK_UNSPECIFIED :
find_option (&dtp->common, dtp->u.p.blank, dtp->u.p.blank_len,
blank_opt,
"Bad BLANK parameter in data transfer statement");
- if (dtp->u.p.blank_status == BLANK_UNSPECIFIED)
+ if (dtp->u.p.blank_status == BLANK_UNSPECIFIED)
dtp->u.p.blank_status = dtp->u.p.current_unit->flags.blank;
- /* Check the delim mode. */
- dtp->u.p.delim_status
+ /* Check the delim mode. */
+ dtp->u.p.current_unit->delim_status
= !(cf & IOPARM_DT_HAS_DELIM) ? DELIM_UNSPECIFIED :
find_option (&dtp->common, dtp->u.p.delim, dtp->u.p.delim_len,
- delim_opt,
- "Bad DELIM parameter in data transfer statement");
+ delim_opt, "Bad DELIM parameter in data transfer statement");
- if (dtp->u.p.delim_status == DELIM_UNSPECIFIED)
- dtp->u.p.delim_status = dtp->u.p.current_unit->flags.delim;
+ if (dtp->u.p.current_unit->delim_status == DELIM_UNSPECIFIED)
+ dtp->u.p.current_unit->delim_status = dtp->u.p.current_unit->flags.delim;
- /* Check the pad mode. */
- dtp->u.p.pad_status
+ /* Check the pad mode. */
+ dtp->u.p.current_unit->pad_status
= !(cf & IOPARM_DT_HAS_PAD) ? PAD_UNSPECIFIED :
find_option (&dtp->common, dtp->u.p.pad, dtp->u.p.pad_len, pad_opt,
"Bad PAD parameter in data transfer statement");
- if (dtp->u.p.pad_status == PAD_UNSPECIFIED)
- dtp->u.p.pad_status = dtp->u.p.current_unit->flags.pad;
- }
+ if (dtp->u.p.current_unit->pad_status == PAD_UNSPECIFIED)
+ dtp->u.p.current_unit->pad_status = dtp->u.p.current_unit->flags.pad;
/* Sanity checks on the record number. */
if ((cf & IOPARM_DT_HAS_REC) != 0)
}
/* Get ready to handle delimiters if needed. */
- d = ' ';
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- switch (dtp->u.p.delim_status)
+ switch (dtp->u.p.current_unit->delim_status)
{
case DELIM_APOSTROPHE:
d = '\'';
}
/* Get ready to handle delimiters if needed. */
- d = ' ';
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- switch (dtp->u.p.delim_status)
+ switch (dtp->u.p.current_unit->delim_status)
{
case DELIM_APOSTROPHE:
d = '\'';
int i, extra;
char *p, d;
- d = ' ';
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- switch (dtp->u.p.delim_status)
+ switch (dtp->u.p.current_unit->delim_status)
{
case DELIM_APOSTROPHE:
d = '\'';
static void
write_complex (st_parameter_dt *dtp, const char *source, int kind, size_t size)
{
- char semi_comma = ',';
-
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- semi_comma = dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';';
+ char semi_comma =
+ dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';';
if (write_char (dtp, '('))
return;
}
else
{
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- {
- if (type != BT_CHARACTER || !dtp->u.p.char_flag ||
- dtp->u.p.delim_status != DELIM_NONE)
- write_separator (dtp);
- }
- else
- {
- if (type != BT_CHARACTER || !dtp->u.p.char_flag)
- write_separator (dtp);
- }
+ if (type != BT_CHARACTER || !dtp->u.p.char_flag ||
+ dtp->u.p.current_unit->delim_status != DELIM_NONE)
+ write_separator (dtp);
}
switch (type)
/* Set the character to be used to separate values
to a comma or semi-colon. */
- char semi_comma = ',';
-
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- semi_comma = dtp->u.p.decimal_status == DECIMAL_POINT ? ',' : ';';
+ char semi_comma =
+ dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';';
/* 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->common.flags & IOPARM_DT_HAS_F2003)
- {
- tmp_delim = dtp->u.p.delim_status;
- if (dtp->u.p.nml_delim == '"')
- dtp->u.p.delim_status = DELIM_QUOTE;
- if (dtp->u.p.nml_delim == '\'')
- dtp->u.p.delim_status = DELIM_APOSTROPHE;
- write_character (dtp, p, 1, obj->string_length);
- dtp->u.p.delim_status = tmp_delim;
- }
- else
- write_character (dtp, p, 1, obj->string_length);
+ tmp_delim = dtp->u.p.current_unit->delim_status;
+ if (dtp->u.p.nml_delim == '"')
+ dtp->u.p.current_unit->delim_status = DELIM_QUOTE;
+ if (dtp->u.p.nml_delim == '\'')
+ dtp->u.p.current_unit->delim_status = DELIM_APOSTROPHE;
+ write_character (dtp, p, 1, obj->string_length);
+ dtp->u.p.current_unit->delim_status = tmp_delim;
break;
case GFC_DTYPE_REAL:
write_real (dtp, p, len);
break;
- case GFC_DTYPE_COMPLEX:
+ case GFC_DTYPE_COMPLEX:
dtp->u.p.no_leading_blank = 0;
num++;
write_complex (dtp, p, len, obj_size);
unit_delim tmp_delim = DELIM_UNSPECIFIED;
/* Set the delimiter for namelist output. */
-if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- {
- tmp_delim = dtp->u.p.delim_status;
+ tmp_delim = dtp->u.p.current_unit->delim_status;
switch (tmp_delim)
{
case (DELIM_QUOTE):
}
/* Temporarily disable namelist delimters. */
- dtp->u.p.delim_status = DELIM_NONE;
- }
+ dtp->u.p.current_unit->delim_status = DELIM_NONE;
+
write_character (dtp, "&", 1, 1);
/* Write namelist name in upper case - f95 std. */
write_character (dtp, " /", 1, 3);
namelist_write_newline (dtp);
/* Restore the original delimiter. */
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- dtp->u.p.delim_status = tmp_delim;
+ dtp->u.p.current_unit->delim_status = tmp_delim;
}
#undef NML_DIGITS
out += nbefore;
}
/* Output the decimal point. */
- if (dtp->common.flags & IOPARM_DT_HAS_F2003)
- *(out++) = dtp->u.p.decimal_status == DECIMAL_POINT ? '.' : ',';
- else
- *(out++) = '.';
+ *(out++) = dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? '.' : ',';
/* Output leading zeros after the decimal point. */
if (nzero > 0)