Mercurial > octave-dspies
diff src/parse.y @ 4540:491ac5f9d120
[project @ 2003-10-16 17:34:07 by jwe]
author | jwe |
---|---|
date | Thu, 16 Oct 2003 17:34:07 +0000 |
parents | 6ceba1f351fb |
children | d1786f2d8a3c |
line wrap: on
line diff
--- a/src/parse.y Thu Oct 16 04:01:30 2003 +0000 +++ b/src/parse.y Thu Oct 16 17:34:07 2003 +0000 @@ -3060,6 +3060,27 @@ return retval; } +static int +text_getc (FILE *f) +{ + int c = getc (f); + + // Convert CRLF into just LF. + + if (c == '\r') + { + c = getc (f); + + if (c != '\n') + { + ungetc (c, f); + c = '\r'; + } + } + + return c; +} + // Eat whitespace and comments from FFILE, returning the text of the // comments read if it doesn't look like a copyright notice. If // IN_PARTS, consider each block of comments separately; otherwise, @@ -3095,7 +3116,7 @@ int c; - while ((c = getc (ffile)) != EOF) + while ((c = text_getc (ffile)) != EOF) { if (update_pos) current_input_column++; @@ -3134,7 +3155,7 @@ if (in_parts) { - if ((c = getc (ffile)) != EOF) + if ((c = text_getc (ffile)) != EOF) { if (update_pos) current_input_column--; @@ -3173,26 +3194,6 @@ } continue; - case '\r': - c = getc (ffile); - if (update_pos) - current_input_column++; - if (c == EOF) - goto done; - else if (c == '\n') - { - if (first_comments_seen) - have_help_text = true; - if (update_pos) - { - input_line_number++; - current_input_column = 0; - } - continue; - } - - // Fall through... - default: if (update_pos) current_input_column--;