ICU-8827 adjust for new @missing values; for Name_Alias only use type=corrections for now

X-SVN-Rev: 31014
This commit is contained in:
Markus Scherer 2011-12-03 00:20:31 +00:00
parent b668e88639
commit 8087532167
3 changed files with 27 additions and 7 deletions

View File

@ -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 "<code point>" which is on the @missing line */
s=u_skipWhitespace(fields[1][0]);
if(0==uprv_strncmp(s, "<code point>", 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);

View File

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

View File

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