From 8087532167d5d6e078fc66a647cebbc24afd0e62 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Sat, 3 Dec 2011 00:20:31 +0000 Subject: [PATCH] ICU-8827 adjust for new @missing values; for Name_Alias only use type=corrections for now X-SVN-Rev: 31014 --- tools/unicode/c/genbidi/genbidi.c | 13 ++++++++++--- tools/unicode/c/gennames/gennames.c | 17 +++++++++++++++-- tools/unicode/c/genprops/props2.cpp | 4 ++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/tools/unicode/c/genbidi/genbidi.c b/tools/unicode/c/genbidi/genbidi.c index f773b1ccb9b..0855699f2c4 100644 --- a/tools/unicode/c/genbidi/genbidi.c +++ b/tools/unicode/c/genbidi/genbidi.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2004-2008, International Business Machines +* Copyright (C) 2004-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -471,9 +471,16 @@ static void U_CALLCONV mirrorLineFn(void *context, char *fields[][2], int32_t fieldCount, UErrorCode *pErrorCode) { + const char *s; char *end; UChar32 src, mirror; + /* ignore "" which is on the @missing line */ + s=u_skipWhitespace(fields[1][0]); + if(0==uprv_strncmp(s, "", 12)) { + return; + } + src=(UChar32)uprv_strtoul(fields[0][0], &end, 16); if(end<=fields[0][0] || end!=fields[0][1]) { fprintf(stderr, "genbidi: syntax error in BidiMirroring.txt field 0 at %s\n", fields[0][0]); @@ -481,8 +488,8 @@ mirrorLineFn(void *context, exit(U_PARSE_ERROR); } - mirror=(UChar32)uprv_strtoul(fields[1][0], &end, 16); - if(end<=fields[1][0] || end!=fields[1][1]) { + mirror=(UChar32)uprv_strtoul(s, &end, 16); + if(end<=s || end!=fields[1][1]) { fprintf(stderr, "genbidi: syntax error in BidiMirroring.txt field 1 at %s\n", fields[1][0]); *pErrorCode=U_PARSE_ERROR; exit(U_PARSE_ERROR); diff --git a/tools/unicode/c/gennames/gennames.c b/tools/unicode/c/gennames/gennames.c index 909d2804a86..2d67443bf44 100644 --- a/tools/unicode/c/gennames/gennames.c +++ b/tools/unicode/c/gennames/gennames.c @@ -524,6 +524,15 @@ nameAliasesLineFn(void *context, exit(U_PARSE_ERROR); } + /* + * Only use "correction" aliases for now, from Unicode 6.1 NameAliases.txt with 3 fields per line. + * TODO: Work on ticket #8963 to deal with multiple type:alias pairs per character. + */ + fields[2][1]=0; + if(0!=uprv_strcmp("correction", fields[2][0])) { + return; + } + /* check that the code points (code) are in ascending order */ if(code<=prevCode && code>0) { fprintf(stderr, "gennames: error - NameAliases entries out of order, U+%04lx after U+%04lx\n", @@ -647,13 +656,17 @@ lineFn(void *context, static void parseNameAliases(const char *filename, Options *storeOptions) { - char *fields[2][2]; + char *fields[3][2]; UErrorCode errorCode=U_ZERO_ERROR; if(!storeOptions->storeNames) { return; } - u_parseDelimitedFile(filename, ';', fields, 2, nameAliasesLineFn, NULL, &errorCode); + /* + * This works only for Unicode 6.1 NameAliases.txt with 3 fields per line. + * TODO: Work on ticket #8963 to deal with multiple type:alias pairs per character. + */ + u_parseDelimitedFile(filename, ';', fields, 3, nameAliasesLineFn, NULL, &errorCode); if(U_FAILURE(errorCode)) { fprintf(stderr, "gennames parse error: %s\n", u_errorName(errorCode)); exit(errorCode); diff --git a/tools/unicode/c/genprops/props2.cpp b/tools/unicode/c/genprops/props2.cpp index 3f8bd5a24aa..a47c691adcd 100644 --- a/tools/unicode/c/genprops/props2.cpp +++ b/tools/unicode/c/genprops/props2.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2002-2010, International Business Machines +* Copyright (C) 2002-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -527,7 +527,7 @@ ageLineFn(void *context, /* ignore "unassigned" (the default is already set to 0.0) */ s=(char *)u_skipWhitespace(fields[1][0]); - if(0==uprv_strncmp(s, "unassigned", 10)) { + if(0==uprv_strncmp(s, "unassigned", 10) || 0==uprv_strncmp(s, "Unassigned", 10)) { return; } -- 2.40.0