aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/read.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2008-04-05 22:18:03 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2008-04-05 22:18:03 +0000
commit10256cbe95ccc432fe9f1aab3c9ccd545dc782ef (patch)
treef9485223018be46b0b89c551ebd74b08c80fa0cb /libgfortran/io/read.c
parent3d3e20df3616f7999bd607306b378a4861cd8b77 (diff)
downloadgcc-10256cbe95ccc432fe9f1aab3c9ccd545dc782ef.zip
gcc-10256cbe95ccc432fe9f1aab3c9ccd545dc782ef.tar.gz
gcc-10256cbe95ccc432fe9f1aab3c9ccd545dc782ef.tar.bz2
PR fortran/25829 28655
2008-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/25829 28655 * gfortran.map: Add new symbol, _gfortran_st_wait. * libgfortran.h (st_paramter_common): Add new I/O parameters. * open.c (st_option decimal_opt[], st_option encoding_opt[], st_option round_opt[], st_option sign_opt[], st_option async_opt[]): New parameter option arrays. (edit_modes): Add checks for new parameters. (new_unit): Likewise. (st_open): Likewise. * list_read.c (CASE_SEPERATORS): Add ';' as a valid separator. (eat_separator): Handle deimal comma. (read_logical): Fix whitespace. (parse_real): Handle decimal comma. (read_real): Handle decimal comma. * read.c (read_a): Use decimal status flag to allow comma in place of a decimal point. (read_f): Allow comma as acceptable character in float. According to decimal flag, substitute a period for a comma. (read_x): If decimal status flag is comma, disable the read_comma flag, not allowing comma as a delimiter, an extension otherwise. * io.h: (unit_decimal, unit_encoding, unit_round, unit_sign, unit_async): New enumerators. Add all new I/O parameters. * unix.c (unix_stream, int_stream): Add io_mode asychronous I/O control. (move_pos_offset, fd_alloc_w_at): Fix some whitespace. (fd_sfree): Use new enumerator. (fd_read): Likewise. (fd_write): Likewise. (fd_close): Fix whitespace. (fd_open): Use new enumertors. (tempfile, regular_file, open_external): Fix whitespace. (output_stream, error_stream): Set method. (stream_offset): Fix whitespace. * transfer.c: (st_option decimal_opt[], sign_opt[], blank_opt[]): New option arrays. (formatted_transfer_scalar): Set sf_read_comma flag based on new decimal_status flag. (data_transfer_init): Initialize new parameters. Add checks for decimal, sign, and blank. (st_wait): New stub. * format.c: (format_lex): Add format specifiers DP, DC, and D. (parse_format_list): Parse the new specifiers. * write.c (write_decimal): Use new sign enumerators to set the sign. (write_complex): Handle decimal comma and semi-colon separator. (nml_write_obj): Likewise. * write_float.def: Revise sign enumerators. (calculate_sign): Use new sign enumerators. (output_float): Likewise. Use new decimal_status flag to set the decimal character to a point or a comma. From-SVN: r133943
Diffstat (limited to 'libgfortran/io/read.c')
-rw-r--r--libgfortran/io/read.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index b5f16ac..bba3772 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -1,5 +1,6 @@
-/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
Contributed by Andy Vaught
+ F2003 I/O support contributed by Jerry DeLisle
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -246,7 +247,8 @@ read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length)
dtp->u.p.sf_read_comma = 0;
source = read_block (dtp, &w);
- dtp->u.p.sf_read_comma = 1;
+ dtp->u.p.sf_read_comma =
+ dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1;
if (source == NULL)
return;
if (w > length)
@@ -601,7 +603,7 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
/* A digit, a '.' or a exponent character ('e', 'E', 'd' or 'D')
is required at this point */
- if (!isdigit (*p) && *p != '.' && *p != 'd' && *p != 'D'
+ if (!isdigit (*p) && *p != '.' && *p != ',' && *p != 'd' && *p != 'D'
&& *p != 'e' && *p != 'E')
goto bad_float;
@@ -614,6 +616,10 @@ read_f (st_parameter_dt *dtp, const fnode *f, char *dest, int length)
{
switch (*p)
{
+ case ',':
+ if (dtp->u.p.decimal_status == DECIMAL_COMMA && *p == ',')
+ *p = '.';
+ /* Fall through */
case '.':
if (seen_dp)
goto bad_float;