From bc6bee2c6dab41b1dab844a18136889df3f7ab51 Mon Sep 17 00:00:00 2001 From: Yves Arrouye Date: Thu, 14 Feb 2002 20:04:35 +0000 Subject: [PATCH] ICU-1708 skip wholly commented out lines. X-SVN-Rev: 7669 --- icu4c/source/tools/makeconv/makeconv.8.in | 10 ++++++---- icu4c/source/tools/makeconv/makeconv.c | 13 ++++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/icu4c/source/tools/makeconv/makeconv.8.in b/icu4c/source/tools/makeconv/makeconv.8.in index f57b9b9e62..6d86eb736c 100644 --- a/icu4c/source/tools/makeconv/makeconv.8.in +++ b/icu4c/source/tools/makeconv/makeconv.8.in @@ -48,10 +48,12 @@ must be in the IBM NLTC ucmap format in order to be understood by .BR makeconv . Comments in the .I convertable -are handled as follows. If a comment (starting with a `#' sign) -does contain the fallback indicator `|' then only the text starting -with the `#' sign, and ending before the `|' sign, is ignored. -Otherwise, the comment runs up to the end of the line. This special +are handled as follows. If a comment (starting with a `#' sign) that +is after some text does contain the fallback indicator `|' then only +the text starting with the `#' sign, and ending before the `|' sign, +is ignored. +Otherwise, or if the comment is the first thing on the line, +the comment runs up to the end of the line. This special handling of comments is to accomodate the practice of putting fallback information in comments in the strict IBM NLTC ucmap format. .PP diff --git a/icu4c/source/tools/makeconv/makeconv.c b/icu4c/source/tools/makeconv/makeconv.c index 178c2346f4..4b821e4877 100644 --- a/icu4c/source/tools/makeconv/makeconv.c +++ b/icu4c/source/tools/makeconv/makeconv.c @@ -109,15 +109,22 @@ parseCodepageBytes(const char *s, uint32_t *pBytes, const char **pEnd) { return length; } -/* Remove all characters followed by '#' +/* Remove all characters followed by '#'. There is an exception if there + * is a fallback sign '|' after the comment and the comment does not + * start in column 0. In this case, we just blank from '#' to just + * before the '|' in order to support the fact that IBM official .ucm + * files have the fallback information in comments! */ static char * removeComments (char *line) { - char *pound = uprv_strchr (line, '#'); + char *pound; + + line = skipWhitespace(line); + pound = uprv_strchr (line, '#'); if (pound != NULL) { - char *fallback = uprv_strchr(pound + 1, '|'); + char *fallback = pound == line ? 0 : uprv_strchr(pound + 1, '|'); if (fallback != NULL) { uprv_memset(pound, ' ', fallback-pound);