diff options
author | Nick Clifton <nickc@redhat.com> | 2003-03-13 11:49:33 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-03-13 11:49:33 +0000 |
commit | 0822d0753e797b3e9e69bec809adc0500192bb40 (patch) | |
tree | be3e1c14331e1e1e01cfe584be5976d3e81f4c6a /gas | |
parent | 053c44e1bfece752ad00adbab7a4ceb57726eb1c (diff) | |
download | gdb-0822d0753e797b3e9e69bec809adc0500192bb40.zip gdb-0822d0753e797b3e9e69bec809adc0500192bb40.tar.gz gdb-0822d0753e797b3e9e69bec809adc0500192bb40.tar.bz2 |
(buffer_and_nest): Store more to sb instead of '\n'.
(get_line_sb): Return end of line character or '\n' if it is zero or
non-existent.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 6 | ||||
-rw-r--r-- | gas/macro.c | 4 | ||||
-rw-r--r-- | gas/read.c | 32 |
3 files changed, 24 insertions, 18 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 148a04b..4f281b7 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2003-03-09 James E Wilson <wilson@tuliptree.org> + + * macro.c (buffer_and_nest): Store more to sb instead of '\n'. + * read.c (get_line_sb): Return end of line character or '\n' if + it is zero or non-existent. + 2003-03-12 Alexandre Oliva <aoliva@redhat.com> * config/tc-mips.c (mips_validate_fix): New function. diff --git a/gas/macro.c b/gas/macro.c index 77dc067..469ca80 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -222,8 +222,8 @@ buffer_and_nest (from, to, ptr, get_line) } } - /* Add a CR to the end and keep running. */ - sb_add_char (ptr, '\n'); + /* Add the original end-of-line char to the end and keep running. */ + sb_add_char (ptr, more); line_start = ptr->len; more = get_line (ptr); } @@ -2235,13 +2235,15 @@ s_lsym (ignore) demand_empty_rest_of_line (); } -/* Read a line into an sb. */ +/* Read a line into an sb. Returns the character that ended the line + or zero if there are no more lines. */ static int get_line_sb (line) sb *line; { char quote1, quote2, inquote; + unsigned char c; if (input_line_pointer[-1] == '\n') bump_line_counters (); @@ -2269,31 +2271,29 @@ get_line_sb (line) inquote = '\0'; - while (!is_end_of_line[(unsigned char) *input_line_pointer] - || (inquote != '\0' && *input_line_pointer != '\n')) + while ((c = * input_line_pointer ++) != 0 + && (!is_end_of_line[c] + || (inquote != '\0' && c != '\n'))) { - if (inquote == *input_line_pointer) + if (inquote == c) inquote = '\0'; else if (inquote == '\0') { - if (*input_line_pointer == quote1) + if (c == quote1) inquote = quote1; - else if (*input_line_pointer == quote2) + else if (c == quote2) inquote = quote2; } - sb_add_char (line, *input_line_pointer++); + sb_add_char (line, c); } - while (input_line_pointer < buffer_limit - && is_end_of_line[(unsigned char) *input_line_pointer]) - { - if (input_line_pointer[-1] == '\n') - bump_line_counters (); - ++input_line_pointer; - } - - return 1; + /* Don't skip multiple end-of-line characters, because that breaks support + for the IA-64 stop bit (;;) which looks like two consecutive end-of-line + characters but isn't. Instead just skip one end of line character and + return the character skipped so that the caller can re-insert it if + necessary. */ + return c; } /* Define a macro. This is an interface to macro.c. */ |