PR libfortran/21875 (FM111.f)
* io/read.c (next_char): Return a ' ' character when BLANK_ZERO
or BLANK_NULL are active.
(read_decimal): Interpret ' ' character correctly for BZ or BN.
(read_radix): Interpret ' ' character correctly for BZ or BN.
(read_f): Interpret ' ' character correctly for BZ or BN.
2005-07-22 Paul Thomas <pault@gcc.gnu.org>
PR libfortran/22570
* read.c (read_x): Correct the condition for doing the
x-editing during formatted input.
* transfer.c (formatted_transfer): Cast offset difference
as int, clean-up arithmetic with new variable, bytes_used,
zero counters for FMT_SLASH,
(data_transfer_init) Zero X- and T-editing counters
unconditionally.
(next_record_w) Zero X- and T-editing counters.
unconditionally.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102284
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-07-22 Jerry DeLisle <jvdelisle@verizon.net>
+
+ PR libfortran/21875 (FM111.f)
+ * io/read.c (next_char): Return a ' ' character when BLANK_ZERO
+ or BLANK_NULL are active.
+ (read_decimal): Interpret ' ' character correctly for BZ or BN.
+ (read_radix): Interpret ' ' character correctly for BZ or BN.
+ (read_f): Interpret ' ' character correctly for BZ or BN.
+
+2005-07-22 Paul Thomas <pault@gcc.gnu.org>
+
+ PR libfortran/22570
+ * read.c (read_x): Correct the condition for doing the
+ x-editing during formatted input.
+ * transfer.c (formatted_transfer): Cast offset difference
+ as int, clean-up arithmetic with new variable, bytes_used,
+ zero counters for FMT_SLASH,
+ (data_transfer_init) Zero X- and T-editing counters
+ unconditionally.
+ (next_record_w) Zero X- and T-editing counters.
+ unconditionally.
+
2005-07-17 Jerry DeLisle <jvdelisle@verizon.net>
* io/write.c (write_float): Fix field width checks for
p++;
w--;
- while (w > 0)
+ if (g.blank_status == BLANK_UNSPECIFIED) /* Normal processing of exponent */
{
- if (*p == ' ')
+ while (w > 0 && isdigit (*p))
{
- if (g.blank_status == BLANK_ZERO) *p = '0';
- if (g.blank_status == BLANK_NULL)
+ exponent = 10 * exponent + *p - '0';
+ p++;
+ w--;
+ }
+
+ /* Only allow trailing blanks */
+
+ while (w > 0)
+ {
+ if (*p != ' ')
+ goto bad_float;
+ p++;
+ w--;
+ }
+ }
+ else /* BZ or BN status is enabled */
+ {
+ while (w > 0)
+ {
+ if (*p == ' ')
{
- p++;
- w--;
- continue;
+ if (g.blank_status == BLANK_ZERO) *p = '0';
+ if (g.blank_status == BLANK_NULL)
+ {
+ p++;
+ w--;
+ continue;
+ }
}
+ else if (!isdigit (*p))
+ goto bad_float;
+
+ exponent = 10 * exponent + *p - '0';
+ p++;
+ w--;
}
- if (!isdigit (*p))
- goto bad_float;
-
- exponent = 10 * exponent + *p - '0';
- p++;
- w--;
}
exponent = exponent * exponent_sign;
void
read_x (fnode * f)
{
- int n, m;
+ int n;
n = f->u.n;
- m = (int)current_unit->bytes_left;
- if (f->format == FMT_X)
- n = (n > m) ? m : n;
- if (n)
+
+ if ((current_unit->flags.pad == PAD_NO || is_internal_unit ())
+ && current_unit->bytes_left < n)
+ n = current_unit->bytes_left;
+
+ if (n > 0)
read_block (&n);
}
static void
formatted_transfer (bt type, void *p, int len)
{
- int pos;
+ int pos, bytes_used;
fnode *f;
format_token t;
int n;
|| t == FMT_STRING))
{
write_x (skips, pending_spaces);
- max_pos = current_unit->recl - current_unit->bytes_left;
+ max_pos = (int)(current_unit->recl - current_unit->bytes_left);
skips = pending_spaces = 0;
}
+ bytes_used = (int)(current_unit->recl - current_unit->bytes_left);
+
switch (t)
{
case FMT_I:
case FMT_TR:
consume_data_flag = 0 ;
- pos = current_unit->recl - current_unit->bytes_left + f->u.n;
- skips = f->u.n;
+ pos = bytes_used + f->u.n + skips;
+ skips = f->u.n + skips;
pending_spaces = pos - max_pos;
/* Writes occur just before the switch on f->format, above, so that
case FMT_TL:
case FMT_T:
if (f->format == FMT_TL)
- pos = current_unit->recl - current_unit->bytes_left - f->u.n;
+ pos = bytes_used - f->u.n;
else /* FMT_T */
{
consume_data_flag = 0;
bring us back again. */
pos = pos < 0 ? 0 : pos;
- skips = skips + pos - (current_unit->recl - current_unit->bytes_left);
+ skips = skips + pos - bytes_used;
pending_spaces = pending_spaces + pos - max_pos;
if (skips == 0)
case FMT_SLASH:
consume_data_flag = 0 ;
+ skips = pending_spaces = 0;
+ current_unit->bytes_left = 0;
next_record (0);
break;
}
/* Reset counters for T and X-editing. */
- if (current_unit->flags.form == FORM_FORMATTED)
- max_pos = skips = pending_spaces = 0;
+ max_pos = skips = pending_spaces = 0;
/* Start the data transfer if we are doing a formatted transfer. */
if (current_unit->flags.form == FORM_FORMATTED && !ioparm.list_format
int length;
char *p;
+ /* Zero counters for X- and T-editing. */
+ max_pos = skips = pending_spaces = 0;
+
switch (current_mode ())
{
case FORMATTED_DIRECT: