diff options
author | Bruno Haible <bruno@clisp.org> | 2003-11-25 11:07:27 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:11:21 +0200 |
commit | e69bdd7e5b115d0c5ec8de42fe0e248e14bbfb2e (patch) | |
tree | e1befe12d3dfb8ac83760ad949e228670a8ae7a9 /gettext-tools/src | |
parent | 569845286dbb89f52ca0c0034ea43139f57ca3d8 (diff) | |
download | external_gettext-e69bdd7e5b115d0c5ec8de42fe0e248e14bbfb2e.zip external_gettext-e69bdd7e5b115d0c5ec8de42fe0e248e14bbfb2e.tar.gz external_gettext-e69bdd7e5b115d0c5ec8de42fe0e248e14bbfb2e.tar.bz2 |
Fix the extraction of tagged comments.
Diffstat (limited to 'gettext-tools/src')
-rw-r--r-- | gettext-tools/src/ChangeLog | 17 | ||||
-rw-r--r-- | gettext-tools/src/x-awk.c | 12 | ||||
-rw-r--r-- | gettext-tools/src/x-c.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-elisp.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/x-java.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-librep.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/x-lisp.c | 6 | ||||
-rw-r--r-- | gettext-tools/src/x-sh.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-tcl.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/x-ycp.c | 26 |
10 files changed, 69 insertions, 20 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 60ab037..8f60594 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,20 @@ +2003-11-22 Bruno Haible <bruno@clisp.org> + + * x-c.c (phase4_getc): Skip leading whitespace in C++ style comments + as well. + * x-sh.c (read_word): Skip leading whitespace in comments. + * x-lisp.c (read_object): Skip leading whitespace in single-line + comments as well. + * x-elisp.c (read_object): Skip leading whitespace in comments. + * x-librep.c (read_object): Skip leading whitespace in single-line + comments as well. + * x-java.c (phase4_getc): Skip leading whitespace in C++ style comments + as well. + * x-awk.c (phase2_getc): Skip leading whitespace in comments. + * x-ycp.c (phase2_getc): Skip leading whitespace in single-line + comments as well. + * x-tcl.c (read_command): Skip leading whitespace in comments. + 2003-11-24 Bruno Haible <bruno@clisp.org> * format-lisp.c (check_params): Use ngettext for one of the messages. diff --git a/gettext-tools/src/x-awk.c b/gettext-tools/src/x-awk.c index 933daed..a902340 100644 --- a/gettext-tools/src/x-awk.c +++ b/gettext-tools/src/x-awk.c @@ -187,12 +187,16 @@ phase2_getc () c = phase1_getc (); if (c == '\n' || c == EOF) break; - if (buflen >= bufmax) + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) { - bufmax = 2 * bufmax + 10; - buffer = xrealloc (buffer, bufmax); + if (buflen >= bufmax) + { + bufmax = 2 * bufmax + 10; + buffer = xrealloc (buffer, bufmax); + } + buffer[buflen++] = c; } - buffer[buflen++] = c; } if (buflen >= bufmax) { diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index cfff2d3..d38bc6a 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -662,7 +662,9 @@ phase4_getc () c = phase3_getc (); if (c == '\n' || c == EOF) break; - comment_add (c); + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); } comment_line_end (0); last_comment_line = newline_count; diff --git a/gettext-tools/src/x-elisp.c b/gettext-tools/src/x-elisp.c index d1ecabc..0325163 100644 --- a/gettext-tools/src/x-elisp.c +++ b/gettext-tools/src/x-elisp.c @@ -864,7 +864,11 @@ read_object (struct object *op, bool first_in_list, bool new_backquote_flag, if (c != ';') all_semicolons = false; if (!all_semicolons) - comment_add (c); + { + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); + } } comment_line_end (0); continue; diff --git a/gettext-tools/src/x-java.c b/gettext-tools/src/x-java.c index eb38a84..04a61c3 100644 --- a/gettext-tools/src/x-java.c +++ b/gettext-tools/src/x-java.c @@ -766,7 +766,9 @@ phase4_getc () c = phase3_getc (); if (RED (c) == '\n' || c == P2_EOF) break; - comment_add (c); + /* We skip all leading white space, but not EOLs. */ + if (!(comment_at_start () && (RED (c) == ' ' || RED (c) == '\t'))) + comment_add (c); } phase3_ungetc (c); /* push back the newline, to decrement line_number */ comment_line_end (0); diff --git a/gettext-tools/src/x-librep.c b/gettext-tools/src/x-librep.c index 106b808..afa99fc 100644 --- a/gettext-tools/src/x-librep.c +++ b/gettext-tools/src/x-librep.c @@ -800,7 +800,11 @@ read_object (struct object *op, flag_context_ty outer_context) if (c != ';') all_semicolons = false; if (!all_semicolons) - comment_add (c); + { + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); + } } comment_line_end (0); continue; diff --git a/gettext-tools/src/x-lisp.c b/gettext-tools/src/x-lisp.c index 0c687ee..c3c8a55 100644 --- a/gettext-tools/src/x-lisp.c +++ b/gettext-tools/src/x-lisp.c @@ -1174,7 +1174,11 @@ read_object (struct object *op, flag_context_ty outer_context) if (c != ';') all_semicolons = false; if (!all_semicolons) - comment_add (c); + { + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); + } } comment_line_end (0); continue; diff --git a/gettext-tools/src/x-sh.c b/gettext-tools/src/x-sh.c index 2d8afa7..de63406 100644 --- a/gettext-tools/src/x-sh.c +++ b/gettext-tools/src/x-sh.c @@ -714,7 +714,9 @@ read_word (struct word *wp, int looking_for, flag_context_ty context) c = phase1_getc (); if (c == EOF || c == '\n') break; - comment_add (c); + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); } comment_line_end (); } diff --git a/gettext-tools/src/x-tcl.c b/gettext-tools/src/x-tcl.c index bfad460..f35143a 100644 --- a/gettext-tools/src/x-tcl.c +++ b/gettext-tools/src/x-tcl.c @@ -830,7 +830,9 @@ read_command (int looking_for, flag_context_ty outer_context) c = phase2_getc (); if (c == EOF || c == CL_BRACE || c == '\n') break; - comment_add (c); + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) + comment_add (c); } comment_line_end (); continue; diff --git a/gettext-tools/src/x-ycp.c b/gettext-tools/src/x-ycp.c index 80a8cfd..e13ed18 100644 --- a/gettext-tools/src/x-ycp.c +++ b/gettext-tools/src/x-ycp.c @@ -159,12 +159,16 @@ phase2_getc () c = phase1_getc (); if (c == '\n' || c == EOF) break; - if (buflen >= bufmax) + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) { - bufmax = 2 * bufmax + 10; - buffer = xrealloc (buffer, bufmax); + if (buflen >= bufmax) + { + bufmax = 2 * bufmax + 10; + buffer = xrealloc (buffer, bufmax); + } + buffer[buflen++] = c; } - buffer[buflen++] = c; } if (buflen >= bufmax) { @@ -201,7 +205,7 @@ phase2_getc () if (c == EOF) break; /* We skip all leading white space, but not EOLs. */ - if (buflen == 0 && isspace (c) && c != '\n') + if (buflen == 0 && (c == ' ' || c == '\t')) continue; if (buflen >= bufmax) { @@ -260,12 +264,16 @@ phase2_getc () c = phase1_getc (); if (c == '\n' || c == EOF) break; - if (buflen >= bufmax) + /* We skip all leading white space, but not EOLs. */ + if (!(buflen == 0 && (c == ' ' || c == '\t'))) { - bufmax = 2 * bufmax + 10; - buffer = xrealloc (buffer, bufmax); + if (buflen >= bufmax) + { + bufmax = 2 * bufmax + 10; + buffer = xrealloc (buffer, bufmax); + } + buffer[buflen++] = c; } - buffer[buflen++] = c; } if (buflen >= bufmax) { |