Commit 78a15b1f by Jerry DeLisle

re PR libfortran/34427 (Revision 130708 breaks namelist input)

2007-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/34427
	* io/list_read.c (read_real): Handle intervening line ends and spaces.
	(get_name): Don't push separators to saved_string.
	(eat_separator): If in namelist mode eat spaces and line ends as well.

From-SVN: r131003
parent 3bee5325
2007-12-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/34427
* io/list_read.c (read_real): Handle intervening line ends and spaces.
(get_name): Don't push separators to saved_string.
(eat_separator): If in namelist mode eat spaces and line ends as well.
2007-12-13 Thomas Koenig <tkoenig@gcc.gnu.org> 2007-12-13 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/34370 PR libfortran/34370
......
...@@ -307,15 +307,31 @@ eat_separator (st_parameter_dt *dtp) ...@@ -307,15 +307,31 @@ eat_separator (st_parameter_dt *dtp)
break; break;
case '\r': case '\r':
dtp->u.p.at_eol = 1;
n = next_char(dtp); n = next_char(dtp);
if (n == '\n') if (n == '\n')
dtp->u.p.at_eol = 1; {
if (dtp->u.p.namelist_mode)
{
do
c = next_char (dtp);
while (c == '\n' || c == '\r' || c == ' ');
unget_char (dtp, c);
}
}
else else
unget_char (dtp, n); unget_char (dtp, n);
break; break;
case '\n': case '\n':
dtp->u.p.at_eol = 1; dtp->u.p.at_eol = 1;
if (dtp->u.p.namelist_mode)
{
do
c = next_char (dtp);
while (c == '\n' || c == '\r' || c == ' ');
unget_char (dtp, c);
}
break; break;
case '!': case '!':
...@@ -1141,12 +1157,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length) ...@@ -1141,12 +1157,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
exp2: exp2:
if (!isdigit (c)) if (!isdigit (c))
{ goto bad;
if (c == 'i' || c == 'I' || c == 'n' || c == 'N')
goto inf_nan;
else
goto bad;
}
push_char (dtp, c); push_char (dtp, c);
...@@ -1315,7 +1326,7 @@ read_real (st_parameter_dt *dtp, int length) ...@@ -1315,7 +1326,7 @@ read_real (st_parameter_dt *dtp, int length)
{ {
char c, message[100]; char c, message[100];
int seen_dp; int seen_dp;
int is_inf, i; int is_inf;
seen_dp = 0; seen_dp = 0;
...@@ -1578,20 +1589,22 @@ read_real (st_parameter_dt *dtp, int length) ...@@ -1578,20 +1589,22 @@ read_real (st_parameter_dt *dtp, int length)
l_push_char (dtp, c); l_push_char (dtp, c);
} }
if (!is_separator (c) || c == '=') if (!is_separator (c))
goto unwind; goto unwind;
if (dtp->u.p.namelist_mode && c != ',' && c != '/') if (dtp->u.p.namelist_mode)
for (i = 0; i < 63; i++) {
{ if (c == ' ' || c =='\n' || c == '\r')
eat_spaces (dtp); {
c = next_char (dtp); do
l_push_char (dtp, c); c = next_char (dtp);
if (c == '=') while (c == ' ' || c =='\n' || c == '\r');
goto unwind;
if (c == ',' || c == '/' || !is_separator(c)) l_push_char (dtp, c);
break;
if (c == '=')
goto unwind;
}
} }
if (is_inf) if (is_inf)
...@@ -2594,7 +2607,8 @@ get_name: ...@@ -2594,7 +2607,8 @@ get_name:
do do
{ {
push_char (dtp, tolower(c)); if (!is_separator (c))
push_char (dtp, tolower(c));
c = next_char (dtp); c = next_char (dtp);
} while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' )); } while (!( c=='=' || c==' ' || c=='\t' || c =='(' || c =='%' ));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment