Commit f2a71504 by Jerry DeLisle

re PR libfortran/35862 ([F2003] Implement new rounding modes for run time)

2009-09-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/35862
	* io.c (format_token): Add enumerators for rounding format specifiers.
	(format_lex): Tokenize the rounding format specifiers.
	(gfc_match_open): Enable rounding modes in OPEN statement.

From-SVN: r152262
parent cb1049f9
2009-09-28 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/35862
* io.c (format_token): Add enumerators for rounding format specifiers.
(format_lex): Tokenize the rounding format specifiers.
(gfc_match_open): Enable rounding modes in OPEN statement.
2009-09-28 Richard Henderson <rth@redhat.com> 2009-09-28 Richard Henderson <rth@redhat.com>
* f95-lang.c (gfc_init_builtin_functions): Update call to * f95-lang.c (gfc_init_builtin_functions): Update call to
......
...@@ -111,7 +111,8 @@ typedef enum ...@@ -111,7 +111,8 @@ typedef enum
FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_LPAREN, FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_LPAREN,
FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F, FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F,
FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END,
FMT_ERROR, FMT_DC, FMT_DP, FMT_T, FMT_TR, FMT_TL, FMT_STAR FMT_ERROR, FMT_DC, FMT_DP, FMT_T, FMT_TR, FMT_TL, FMT_STAR, FMT_RC,
FMT_RD, FMT_RN, FMT_RP, FMT_RU, FMT_RZ
} }
format_token; format_token;
...@@ -467,6 +468,35 @@ format_lex (void) ...@@ -467,6 +468,35 @@ format_lex (void)
} }
break; break;
case 'R':
c = next_char_not_space (&error);
switch (c)
{
case 'C':
token = FMT_RC;
break;
case 'D':
token = FMT_RD;
break;
case 'N':
token = FMT_RN;
break;
case 'P':
token = FMT_RP;
break;
case 'U':
token = FMT_RU;
break;
case 'Z':
token = FMT_RZ;
break;
default:
token = FMT_UNKNOWN;
unget_char ();
break;
}
break;
case '\0': case '\0':
token = FMT_END; token = FMT_END;
break; break;
...@@ -623,6 +653,12 @@ format_item_1: ...@@ -623,6 +653,12 @@ format_item_1:
case FMT_BLANK: case FMT_BLANK:
case FMT_DP: case FMT_DP:
case FMT_DC: case FMT_DC:
case FMT_RC:
case FMT_RD:
case FMT_RN:
case FMT_RP:
case FMT_RU:
case FMT_RZ:
goto between_desc; goto between_desc;
case FMT_CHAR: case FMT_CHAR:
...@@ -1924,8 +1960,8 @@ gfc_match_open (void) ...@@ -1924,8 +1960,8 @@ gfc_match_open (void)
/* Checks on the ROUND specifier. */ /* Checks on the ROUND specifier. */
if (open->round) if (open->round)
{ {
/* When implemented, change the following to use gfc_notify_std F2003. */ if (gfc_notify_std (GFC_STD_F2003, "Fortran F2003: ROUND= at %C "
gfc_error ("Fortran F2003: ROUND= specifier at %C not implemented"); "not allowed in Fortran 95") == FAILURE)
goto cleanup; goto cleanup;
if (open->round->expr_type == EXPR_CONSTANT) if (open->round->expr_type == EXPR_CONSTANT)
...@@ -3275,12 +3311,9 @@ if (condition) \ ...@@ -3275,12 +3311,9 @@ if (condition) \
if (dt->round) if (dt->round)
{ {
/* When implemented, change the following to use gfc_notify_std F2003.
if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ROUND= at %C " if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: ROUND= at %C "
"not allowed in Fortran 95") == FAILURE) "not allowed in Fortran 95") == FAILURE)
return MATCH_ERROR; */ return MATCH_ERROR;
gfc_error ("F2003 Feature: ROUND= specifier at %C not implemented");
return MATCH_ERROR;
if (dt->round->expr_type == EXPR_CONSTANT) if (dt->round->expr_type == EXPR_CONSTANT)
{ {
......
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