This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch proposal for PR 19678


Hi all,

I'd like to submit a simple patch fixing PR 19678 (DOS files don't work for list directed input). It is just a matter of adding support for DOS end-of-line in libgfortran/io/list_read.c. The patch I submit here fixes the issue reported in the PR, as well as a few others I could imagine. *strapped and regtested on i686-linux.

I hereby donate this patch to the FSF, unless they receive my copyright assignment before this patch is accepted ;-)

PS: I don't know if the way I propose patches is appropriate (diff format, eg). If not, any pointer on GCC patch-submitting policies is welcome!


2005-02-24 FranÃois-Xavier Coudert <coudert@clipper.ens.fr>


	PR libfortran/19678
	* list_read.c: Add support for DOS files


Index: gcc/libgfortran/list_read.c =================================================================== RCS file: /cvsroot/gcc/gcc/libgfortran/io/list_read.c,v retrieving revision 1.13 diff -u -r1.13 list_read.c --- list_read.c 12 Jan 2005 21:27:31 -0000 1.13 +++ list_read.c 24 Feb 2005 13:09:26 -0000 @@ -66,12 +66,13 @@ #define CASE_DIGITS case '0': case '1': case '2': case '3': case '4': \ case '5': case '6': case '7': case '8': case '9'

-#define CASE_SEPARATORS  case ' ': case ',': case '/': case '\n': case '\t'
+#define CASE_SEPARATORS  case ' ': case ',': case '/': case '\n': case '\t': \
+                         case '\r'

/* This macro assumes that we're operating on a variable. */

 #define is_separator(c) (c == '/' ||  c == ',' || c == '\n' || c == ' ' \
-                         || c == '\t')
+                         || c == '\t' || c == '\r')

/* Maximum repeat count. Less than ten times the maximum signed int32. */

@@ -163,7 +164,7 @@
     c = *p;

 done:
-  at_eol = (c == '\n');
+  at_eol = (c == '\n' || c == '\r');
   return c;
 }

@@ -230,6 +231,7 @@
       break;

     case '\n':
+    case '\r':
       break;

     case '!':
@@ -284,6 +286,7 @@
       break;

     case '\n':
+    case '\r':
       goto restart;

     case '!':
@@ -1052,7 +1055,7 @@
          goto got_repeat;

        CASE_SEPARATORS:
-          if (c != '\n' &&  c != ',')
+          if (c != '\n' &&  c != ',' && c != '\r')
             unget_char (c);    /* Real number that is just a digit-string.  */
          goto done;

@@ -1485,6 +1488,7 @@
           return;
         case ' ':
         case '\n':
+       case '\r':
         case '\t':
           break;
         case ',':


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]