ICU-1708 skip wholly commented out lines.

X-SVN-Rev: 7669
This commit is contained in:
Yves Arrouye 2002-02-14 20:04:35 +00:00
parent ed189cc538
commit bc6bee2c6d
2 changed files with 16 additions and 7 deletions

View File

@ -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

View File

@ -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);