diff --git a/icu4c/source/common/upropset.cpp b/icu4c/source/common/upropset.cpp index 15c78b7b7b..55c0c96d49 100644 --- a/icu4c/source/common/upropset.cpp +++ b/icu4c/source/common/upropset.cpp @@ -17,6 +17,8 @@ #include "charstr.h" +static UMTX PROPSET_MUTEX = NULL; + static Hashtable* NAME_MAP = NULL; static Hashtable* CATEGORY_MAP = NULL; @@ -142,6 +144,10 @@ U_CFUNC UBool upropset_cleanup(void) { delete[] SCRIPT_CACHE; SCRIPT_CACHE = NULL; delete INCLUSIONS; INCLUSIONS = NULL; } + if (PROPSET_MUTEX) { + umtx_destroy(&PROPSET_MUTEX); + PROPSET_MUTEX = NULL; + } return TRUE; } @@ -465,6 +471,8 @@ UnicodePropertySet::getRuleWhiteSpaceSet(UErrorCode &status) { UnicodeSet set; int32_t code; + init(status); + /* "white space" in the sense of ICU rule parsers: Cf+White_Space */ code = UCHAR_WHITE_SPACE; initSetFromFilter(set, _binaryPropertyFilter, &code, status); @@ -622,6 +630,9 @@ void UnicodePropertySet::initSetFromFilter(UnicodeSet& set, Filter filter, // Type and value name maps //---------------------------------------------------------------- +#define ADDTYPE(shortName, longName, factory) \ + addType(UNICODE_STRING_SIMPLE(shortName), UNICODE_STRING_SIMPLE(longName), factory) + /** * Add a type mapping to the name map. */ @@ -634,6 +645,9 @@ void UnicodePropertySet::addType(const UnicodeString& shortName, NAME_MAP->put(longName, p, ec); } +#define ADDVALUE(map, shortName, longName, value) \ + addValue(map, UNICODE_STRING_SIMPLE(shortName), UNICODE_STRING_SIMPLE(longName), value) + /** * Add a value mapping to the name map. */ @@ -650,28 +664,56 @@ void UnicodePropertySet::addValue(Hashtable* map, } void UnicodePropertySet::init(UErrorCode &status) { - if (NAME_MAP != NULL) { + if (SCRIPT_CACHE != NULL) { return; } - Mutex lock; - NAME_MAP = new Hashtable(TRUE); - CATEGORY_MAP = new Hashtable(TRUE); - COMBINING_CLASS_MAP = new Hashtable(TRUE); - BIDI_CLASS_MAP = new Hashtable(TRUE); - BINARY_PROPERTY_MAP = new Hashtable(TRUE); - BOOLEAN_VALUE_MAP = new Hashtable(TRUE); - SCRIPT_CACHE = new UnicodeSet[(size_t)USCRIPT_CODE_LIMIT]; - CATEGORY_CACHE = new UnicodeSet[32]; // 32 is guaranteed by the Unicode standard - INCLUSIONS = new UnicodeSet(INCLUSIONS_PATTERN, status); + umtx_lock(NULL); + if (PROPSET_MUTEX == NULL) { + umtx_init(&PROPSET_MUTEX); + } + umtx_unlock(NULL); - if (!NAME_MAP || !CATEGORY_MAP || !COMBINING_CLASS_MAP || !BINARY_PROPERTY_MAP - || !BOOLEAN_VALUE_MAP || !SCRIPT_CACHE || !CATEGORY_CACHE || !INCLUSIONS) + umtx_lock(&PROPSET_MUTEX); + if (SCRIPT_CACHE == NULL) { + SCRIPT_CACHE = new UnicodeSet[(size_t)USCRIPT_CODE_LIMIT]; + CATEGORY_CACHE = new UnicodeSet[32]; // 32 is guaranteed by the Unicode standard + INCLUSIONS = new UnicodeSet(INCLUSIONS_PATTERN, status); // This may call us again! + } + umtx_unlock(&PROPSET_MUTEX); + + if (!SCRIPT_CACHE || !CATEGORY_CACHE || !INCLUSIONS) { status = U_MEMORY_ALLOCATION_ERROR; return; } + UBool didInit = FALSE; + umtx_lock(&PROPSET_MUTEX); + if (NAME_MAP == NULL) { + NAME_MAP = new Hashtable(TRUE); + CATEGORY_MAP = new Hashtable(TRUE); + COMBINING_CLASS_MAP = new Hashtable(TRUE); + BIDI_CLASS_MAP = new Hashtable(TRUE); + BINARY_PROPERTY_MAP = new Hashtable(TRUE); + BOOLEAN_VALUE_MAP = new Hashtable(TRUE); + didInit = TRUE; + } + umtx_unlock(&PROPSET_MUTEX); + if (!didInit) { + /* TODO: Can we really return here? Is it safe? Should we wait? */ + return; + } + + if (!NAME_MAP || !CATEGORY_MAP || !COMBINING_CLASS_MAP || !BINARY_PROPERTY_MAP + || !BOOLEAN_VALUE_MAP) + { + status = U_MEMORY_ALLOCATION_ERROR; + return; + } + + umtx_lock(&PROPSET_MUTEX); /* unlock at the end of the function */ + u_enumCharTypes(_enumCategoryRange, 0); // NOTE: All short and long names taken from @@ -684,97 +726,97 @@ void UnicodePropertySet::init(UErrorCode &status) { //------------------------------------------------------------ // MAIN KEY MAP - addType("GC", "GENERALCATEGORY", createCategorySet); + ADDTYPE("GC", "GENERALCATEGORY", createCategorySet); - addType("CCC", "CANONICALCOMBININGCLASS", createCombiningClassSet); + ADDTYPE("CCC", "CANONICALCOMBININGCLASS", createCombiningClassSet); - addType("BC", "BIDICLASS", createBidiClassSet); + ADDTYPE("BC", "BIDICLASS", createBidiClassSet); //addType("DT", "DECOMPOSITIONTYPE", DECOMPOSITION_TYPE); - addType("NV", "NUMERICVALUE", createNumericValueSet); + ADDTYPE("NV", "NUMERICVALUE", createNumericValueSet); //addType("NT", "NUMERICTYPE", NUMERIC_TYPE); //addType("EA", "EASTASIANWIDTH", EAST_ASIAN_WIDTH); //addType("LB", "LINEBREAK", LINE_BREAK); //addType("JT", "JOININGTYPE", JOINING_TYPE); - addType("SC", "SCRIPT", createScriptSet); + ADDTYPE("SC", "SCRIPT", createScriptSet); //------------------------------------------------------------ // Boolean Value MAP - addValue(BOOLEAN_VALUE_MAP, "T", "TRUE", MAPVAL + 1); - addValue(BOOLEAN_VALUE_MAP, "F", "FALSE", MAPVAL + 0); + ADDVALUE(BOOLEAN_VALUE_MAP, "T", "TRUE", MAPVAL + 1); + ADDVALUE(BOOLEAN_VALUE_MAP, "F", "FALSE", MAPVAL + 0); //------------------------------------------------------------ // General Category MAP - addValue(CATEGORY_MAP, "ANY", "", ANY); // special case + ADDVALUE(CATEGORY_MAP, "ANY", "", ANY); // special case - addValue(CATEGORY_MAP, "ASCII", "", ASCII); // special case + ADDVALUE(CATEGORY_MAP, "ASCII", "", ASCII); // special case - addValue(CATEGORY_MAP, "C", "OTHER", + ADDVALUE(CATEGORY_MAP, "C", "OTHER", (1 << U_CONTROL_CHAR) | (1 << U_FORMAT_CHAR) | (1 << U_GENERAL_OTHER_TYPES) | (1 << U_PRIVATE_USE_CHAR) | (1 << U_SURROGATE)); - addValue(CATEGORY_MAP, "CC", "CONTROL", + ADDVALUE(CATEGORY_MAP, "CC", "CONTROL", 1 << U_CONTROL_CHAR); - addValue(CATEGORY_MAP, "CF", "FORMAT", + ADDVALUE(CATEGORY_MAP, "CF", "FORMAT", 1 << U_FORMAT_CHAR); - addValue(CATEGORY_MAP, "CN", "UNASSIGNED", + ADDVALUE(CATEGORY_MAP, "CN", "UNASSIGNED", 1 << U_GENERAL_OTHER_TYPES); - addValue(CATEGORY_MAP, "CO", "PRIVATEUSE", + ADDVALUE(CATEGORY_MAP, "CO", "PRIVATEUSE", 1 << U_PRIVATE_USE_CHAR); - addValue(CATEGORY_MAP, "CS", "SURROGATE", + ADDVALUE(CATEGORY_MAP, "CS", "SURROGATE", 1 << U_SURROGATE); - addValue(CATEGORY_MAP, "L", "LETTER", + ADDVALUE(CATEGORY_MAP, "L", "LETTER", (1 << U_LOWERCASE_LETTER) | (1 << U_MODIFIER_LETTER) | (1 << U_OTHER_LETTER) | (1 << U_TITLECASE_LETTER) | (1 << U_UPPERCASE_LETTER)); - addValue(CATEGORY_MAP, "LL", "LOWERCASELETTER", + ADDVALUE(CATEGORY_MAP, "LL", "LOWERCASELETTER", 1 << U_LOWERCASE_LETTER); - addValue(CATEGORY_MAP, "LM", "MODIFIERLETTER", + ADDVALUE(CATEGORY_MAP, "LM", "MODIFIERLETTER", 1 << U_MODIFIER_LETTER); - addValue(CATEGORY_MAP, "LO", "OTHERLETTER", + ADDVALUE(CATEGORY_MAP, "LO", "OTHERLETTER", 1 << U_OTHER_LETTER); - addValue(CATEGORY_MAP, "LT", "TITLECASELETTER", + ADDVALUE(CATEGORY_MAP, "LT", "TITLECASELETTER", 1 << U_TITLECASE_LETTER); - addValue(CATEGORY_MAP, "LU", "UPPERCASELETTER", + ADDVALUE(CATEGORY_MAP, "LU", "UPPERCASELETTER", 1 << U_UPPERCASE_LETTER); - addValue(CATEGORY_MAP, "M", "MARK", + ADDVALUE(CATEGORY_MAP, "M", "MARK", (1 << U_NON_SPACING_MARK) | (1 << U_COMBINING_SPACING_MARK) | (1 << U_ENCLOSING_MARK)); - addValue(CATEGORY_MAP, "MN", "NONSPACINGMARK", + ADDVALUE(CATEGORY_MAP, "MN", "NONSPACINGMARK", 1 << U_NON_SPACING_MARK); - addValue(CATEGORY_MAP, "MC", "SPACINGMARK", + ADDVALUE(CATEGORY_MAP, "MC", "SPACINGMARK", 1 << U_COMBINING_SPACING_MARK); - addValue(CATEGORY_MAP, "ME", "ENCLOSINGMARK", + ADDVALUE(CATEGORY_MAP, "ME", "ENCLOSINGMARK", 1 << U_ENCLOSING_MARK); - addValue(CATEGORY_MAP, "N", "NUMBER", + ADDVALUE(CATEGORY_MAP, "N", "NUMBER", (1 << U_DECIMAL_DIGIT_NUMBER) | (1 << U_LETTER_NUMBER) | (1 << U_OTHER_NUMBER)); - addValue(CATEGORY_MAP, "ND", "DECIMALNUMBER", + ADDVALUE(CATEGORY_MAP, "ND", "DECIMALNUMBER", 1 << U_DECIMAL_DIGIT_NUMBER); - addValue(CATEGORY_MAP, "NL", "LETTERNUMBER", + ADDVALUE(CATEGORY_MAP, "NL", "LETTERNUMBER", 1 << U_LETTER_NUMBER); - addValue(CATEGORY_MAP, "NO", "OTHERNUMBER", + ADDVALUE(CATEGORY_MAP, "NO", "OTHERNUMBER", 1 << U_OTHER_NUMBER); - addValue(CATEGORY_MAP, "P", "PUNCTUATION", + ADDVALUE(CATEGORY_MAP, "P", "PUNCTUATION", (1 << U_CONNECTOR_PUNCTUATION) | (1 << U_DASH_PUNCTUATION) | (1 << U_END_PUNCTUATION) | @@ -783,92 +825,92 @@ void UnicodePropertySet::init(UErrorCode &status) { (1 << U_OTHER_PUNCTUATION) | (1 << U_START_PUNCTUATION)); - addValue(CATEGORY_MAP, "PC", "CONNECTORPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PC", "CONNECTORPUNCTUATION", 1 << U_CONNECTOR_PUNCTUATION); - addValue(CATEGORY_MAP, "PD", "DASHPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PD", "DASHPUNCTUATION", 1 << U_DASH_PUNCTUATION); - addValue(CATEGORY_MAP, "PE", "ENDPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PE", "ENDPUNCTUATION", 1 << U_END_PUNCTUATION); - addValue(CATEGORY_MAP, "PF", "FINALPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PF", "FINALPUNCTUATION", 1 << U_FINAL_PUNCTUATION); - addValue(CATEGORY_MAP, "PI", "INITIALPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PI", "INITIALPUNCTUATION", 1 << U_INITIAL_PUNCTUATION); - addValue(CATEGORY_MAP, "PO", "OTHERPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PO", "OTHERPUNCTUATION", 1 << U_OTHER_PUNCTUATION); - addValue(CATEGORY_MAP, "PS", "STARTPUNCTUATION", + ADDVALUE(CATEGORY_MAP, "PS", "STARTPUNCTUATION", 1 << U_START_PUNCTUATION); - addValue(CATEGORY_MAP, "S", "SYMBOL", + ADDVALUE(CATEGORY_MAP, "S", "SYMBOL", (1 << U_CURRENCY_SYMBOL) | (1 << U_MODIFIER_SYMBOL) | (1 << U_MATH_SYMBOL) | (1 << U_OTHER_SYMBOL)); - addValue(CATEGORY_MAP, "SC", "CURRENCYSYMBOL", + ADDVALUE(CATEGORY_MAP, "SC", "CURRENCYSYMBOL", 1 << U_CURRENCY_SYMBOL); - addValue(CATEGORY_MAP, "SK", "MODIFIERSYMBOL", + ADDVALUE(CATEGORY_MAP, "SK", "MODIFIERSYMBOL", 1 << U_MODIFIER_SYMBOL); - addValue(CATEGORY_MAP, "SM", "MATHSYMBOL", + ADDVALUE(CATEGORY_MAP, "SM", "MATHSYMBOL", 1 << U_MATH_SYMBOL); - addValue(CATEGORY_MAP, "SO", "OTHERSYMBOL", + ADDVALUE(CATEGORY_MAP, "SO", "OTHERSYMBOL", 1 << U_OTHER_SYMBOL); - addValue(CATEGORY_MAP, "Z", "SEPARATOR", + ADDVALUE(CATEGORY_MAP, "Z", "SEPARATOR", (1 << U_LINE_SEPARATOR) | (1 << U_PARAGRAPH_SEPARATOR) | (1 << U_SPACE_SEPARATOR)); - addValue(CATEGORY_MAP, "ZL", "LINESEPARATOR", + ADDVALUE(CATEGORY_MAP, "ZL", "LINESEPARATOR", 1 << U_LINE_SEPARATOR); - addValue(CATEGORY_MAP, "ZP", "PARAGRAPHSEPARATOR", + ADDVALUE(CATEGORY_MAP, "ZP", "PARAGRAPHSEPARATOR", 1 << U_PARAGRAPH_SEPARATOR); - addValue(CATEGORY_MAP, "ZS", "SPACESEPARATOR", + ADDVALUE(CATEGORY_MAP, "ZS", "SPACESEPARATOR", 1 << U_SPACE_SEPARATOR); //------------------------------------------------------------ // Combining Class MAP - addValue(COMBINING_CLASS_MAP, "NR", "NOTREORDERED", MAPVAL + 0); - addValue(COMBINING_CLASS_MAP, "OV", "OVERLAY", MAPVAL + 1); - addValue(COMBINING_CLASS_MAP, "NU", "NUKTA", MAPVAL + 7); - addValue(COMBINING_CLASS_MAP, "KV", "KANAVOICING", MAPVAL + 8); - addValue(COMBINING_CLASS_MAP, "V", "VIRAMA", MAPVAL + 9); - addValue(COMBINING_CLASS_MAP, "ATBL", "ATTACHEDBELOWLEFT", MAPVAL + 202); - addValue(COMBINING_CLASS_MAP, "ATAR", "ATTACHEDABOVERIGHT", MAPVAL + 216); - addValue(COMBINING_CLASS_MAP, "BL", "BELOWLEFT", MAPVAL + 218); - addValue(COMBINING_CLASS_MAP, "B", "BELOW", MAPVAL + 220); - addValue(COMBINING_CLASS_MAP, "BR", "BELOWRIGHT", MAPVAL + 222); - addValue(COMBINING_CLASS_MAP, "L", "LEFT", MAPVAL + 224); - addValue(COMBINING_CLASS_MAP, "R", "RIGHT", MAPVAL + 226); - addValue(COMBINING_CLASS_MAP, "AL", "ABOVELEFT", MAPVAL + 228); - addValue(COMBINING_CLASS_MAP, "A", "ABOVE", MAPVAL + 230); - addValue(COMBINING_CLASS_MAP, "AR", "ABOVERIGHT", MAPVAL + 232); - addValue(COMBINING_CLASS_MAP, "DB", "DOUBLEBELOW", MAPVAL + 232); - addValue(COMBINING_CLASS_MAP, "DA", "DOUBLEABOVE", MAPVAL + 234); - addValue(COMBINING_CLASS_MAP, "IS", "IOTASUBSCRIPT", MAPVAL + 240); + ADDVALUE(COMBINING_CLASS_MAP, "NR", "NOTREORDERED", MAPVAL + 0); + ADDVALUE(COMBINING_CLASS_MAP, "OV", "OVERLAY", MAPVAL + 1); + ADDVALUE(COMBINING_CLASS_MAP, "NU", "NUKTA", MAPVAL + 7); + ADDVALUE(COMBINING_CLASS_MAP, "KV", "KANAVOICING", MAPVAL + 8); + ADDVALUE(COMBINING_CLASS_MAP, "V", "VIRAMA", MAPVAL + 9); + ADDVALUE(COMBINING_CLASS_MAP, "ATBL", "ATTACHEDBELOWLEFT", MAPVAL + 202); + ADDVALUE(COMBINING_CLASS_MAP, "ATAR", "ATTACHEDABOVERIGHT", MAPVAL + 216); + ADDVALUE(COMBINING_CLASS_MAP, "BL", "BELOWLEFT", MAPVAL + 218); + ADDVALUE(COMBINING_CLASS_MAP, "B", "BELOW", MAPVAL + 220); + ADDVALUE(COMBINING_CLASS_MAP, "BR", "BELOWRIGHT", MAPVAL + 222); + ADDVALUE(COMBINING_CLASS_MAP, "L", "LEFT", MAPVAL + 224); + ADDVALUE(COMBINING_CLASS_MAP, "R", "RIGHT", MAPVAL + 226); + ADDVALUE(COMBINING_CLASS_MAP, "AL", "ABOVELEFT", MAPVAL + 228); + ADDVALUE(COMBINING_CLASS_MAP, "A", "ABOVE", MAPVAL + 230); + ADDVALUE(COMBINING_CLASS_MAP, "AR", "ABOVERIGHT", MAPVAL + 232); + ADDVALUE(COMBINING_CLASS_MAP, "DB", "DOUBLEBELOW", MAPVAL + 232); + ADDVALUE(COMBINING_CLASS_MAP, "DA", "DOUBLEABOVE", MAPVAL + 234); + ADDVALUE(COMBINING_CLASS_MAP, "IS", "IOTASUBSCRIPT", MAPVAL + 240); //------------------------------------------------------------ // Bidi Class MAP - addValue(BIDI_CLASS_MAP, "AL", "ARABICLETTER", MAPVAL + U_RIGHT_TO_LEFT_ARABIC); - addValue(BIDI_CLASS_MAP, "AN", "ARABICNUMBER", MAPVAL + U_ARABIC_NUMBER); - addValue(BIDI_CLASS_MAP, "B", "PARAGRAPHSEPARATOR", MAPVAL + U_BLOCK_SEPARATOR); - addValue(BIDI_CLASS_MAP, "BN", "BOUNDARYNEUTRAL", MAPVAL + U_BOUNDARY_NEUTRAL); - addValue(BIDI_CLASS_MAP, "CS", "COMMONSEPARATOR", MAPVAL + U_COMMON_NUMBER_SEPARATOR); - addValue(BIDI_CLASS_MAP, "EN", "EUROPEANNUMBER", MAPVAL + U_EUROPEAN_NUMBER); - addValue(BIDI_CLASS_MAP, "ES", "EUROPEANSEPARATOR", MAPVAL + U_EUROPEAN_NUMBER_SEPARATOR); - addValue(BIDI_CLASS_MAP, "ET", "EUROPEANTERMINATOR", MAPVAL + U_EUROPEAN_NUMBER_TERMINATOR); - addValue(BIDI_CLASS_MAP, "L", "LEFTTORIGHT", MAPVAL + U_LEFT_TO_RIGHT); - addValue(BIDI_CLASS_MAP, "LRE", "LEFTTORIGHTEMBEDDING", MAPVAL + U_LEFT_TO_RIGHT_EMBEDDING); - addValue(BIDI_CLASS_MAP, "LRO", "LEFTTORIGHTOVERRIDE", MAPVAL + U_LEFT_TO_RIGHT_OVERRIDE); - addValue(BIDI_CLASS_MAP, "NSM", "NONSPACINGMARK", MAPVAL + U_DIR_NON_SPACING_MARK); - addValue(BIDI_CLASS_MAP, "ON", "OTHERNEUTRAL", MAPVAL + U_OTHER_NEUTRAL); - addValue(BIDI_CLASS_MAP, "PDF", "POPDIRECTIONALFORMAT", MAPVAL + U_POP_DIRECTIONAL_FORMAT); - addValue(BIDI_CLASS_MAP, "R", "RIGHTTOLEFT", MAPVAL + U_RIGHT_TO_LEFT); - addValue(BIDI_CLASS_MAP, "RLE", "RIGHTTOLEFTEMBEDDING", MAPVAL + U_RIGHT_TO_LEFT_EMBEDDING); - addValue(BIDI_CLASS_MAP, "RLO", "RIGHTTOLEFTOVERRIDE", MAPVAL + U_RIGHT_TO_LEFT_OVERRIDE); - addValue(BIDI_CLASS_MAP, "S", "SEGMENTSEPARATOR", MAPVAL + U_SEGMENT_SEPARATOR); - addValue(BIDI_CLASS_MAP, "WS", "WHITESPACENEUTRAL", MAPVAL + U_WHITE_SPACE_NEUTRAL); + ADDVALUE(BIDI_CLASS_MAP, "AL", "ARABICLETTER", MAPVAL + U_RIGHT_TO_LEFT_ARABIC); + ADDVALUE(BIDI_CLASS_MAP, "AN", "ARABICNUMBER", MAPVAL + U_ARABIC_NUMBER); + ADDVALUE(BIDI_CLASS_MAP, "B", "PARAGRAPHSEPARATOR", MAPVAL + U_BLOCK_SEPARATOR); + ADDVALUE(BIDI_CLASS_MAP, "BN", "BOUNDARYNEUTRAL", MAPVAL + U_BOUNDARY_NEUTRAL); + ADDVALUE(BIDI_CLASS_MAP, "CS", "COMMONSEPARATOR", MAPVAL + U_COMMON_NUMBER_SEPARATOR); + ADDVALUE(BIDI_CLASS_MAP, "EN", "EUROPEANNUMBER", MAPVAL + U_EUROPEAN_NUMBER); + ADDVALUE(BIDI_CLASS_MAP, "ES", "EUROPEANSEPARATOR", MAPVAL + U_EUROPEAN_NUMBER_SEPARATOR); + ADDVALUE(BIDI_CLASS_MAP, "ET", "EUROPEANTERMINATOR", MAPVAL + U_EUROPEAN_NUMBER_TERMINATOR); + ADDVALUE(BIDI_CLASS_MAP, "L", "LEFTTORIGHT", MAPVAL + U_LEFT_TO_RIGHT); + ADDVALUE(BIDI_CLASS_MAP, "LRE", "LEFTTORIGHTEMBEDDING", MAPVAL + U_LEFT_TO_RIGHT_EMBEDDING); + ADDVALUE(BIDI_CLASS_MAP, "LRO", "LEFTTORIGHTOVERRIDE", MAPVAL + U_LEFT_TO_RIGHT_OVERRIDE); + ADDVALUE(BIDI_CLASS_MAP, "NSM", "NONSPACINGMARK", MAPVAL + U_DIR_NON_SPACING_MARK); + ADDVALUE(BIDI_CLASS_MAP, "ON", "OTHERNEUTRAL", MAPVAL + U_OTHER_NEUTRAL); + ADDVALUE(BIDI_CLASS_MAP, "PDF", "POPDIRECTIONALFORMAT", MAPVAL + U_POP_DIRECTIONAL_FORMAT); + ADDVALUE(BIDI_CLASS_MAP, "R", "RIGHTTOLEFT", MAPVAL + U_RIGHT_TO_LEFT); + ADDVALUE(BIDI_CLASS_MAP, "RLE", "RIGHTTOLEFTEMBEDDING", MAPVAL + U_RIGHT_TO_LEFT_EMBEDDING); + ADDVALUE(BIDI_CLASS_MAP, "RLO", "RIGHTTOLEFTOVERRIDE", MAPVAL + U_RIGHT_TO_LEFT_OVERRIDE); + ADDVALUE(BIDI_CLASS_MAP, "S", "SEGMENTSEPARATOR", MAPVAL + U_SEGMENT_SEPARATOR); + ADDVALUE(BIDI_CLASS_MAP, "WS", "WHITESPACENEUTRAL", MAPVAL + U_WHITE_SPACE_NEUTRAL); //------------------------------------------------------------ // Binary Properties MAP. Names taken from PropertyAliases.txt. @@ -889,40 +931,42 @@ void UnicodePropertySet::init(UErrorCode &status) { // XO_NFKC ; Expands_On_NFKC // XO_NFKD ; Expands_On_NFKD - addValue(BINARY_PROPERTY_MAP, "ALPHA", "ALPHABETIC", MAPVAL + UCHAR_ALPHABETIC); - addValue(BINARY_PROPERTY_MAP, "AHEX", "ASCII_HEXDIGIT", MAPVAL + UCHAR_ASCII_HEX_DIGIT); - addValue(BINARY_PROPERTY_MAP, "BIDIC", "BIDICONTROL", MAPVAL + UCHAR_BIDI_CONTROL); - addValue(BINARY_PROPERTY_MAP, "BIDIM", "BIDIMIRRORED", MAPVAL + UCHAR_BIDI_MIRRORED); - addValue(BINARY_PROPERTY_MAP, "DASH", "", MAPVAL + UCHAR_DASH); - addValue(BINARY_PROPERTY_MAP, "DI", "DEFAULTIGNORABLECODEPOINT", MAPVAL + UCHAR_DEFAULT_IGNORABLE_CODE_POINT); - addValue(BINARY_PROPERTY_MAP, "DEP", "DEPRECATED", MAPVAL + UCHAR_DEPRECATED); - addValue(BINARY_PROPERTY_MAP, "DIA", "DIACRITIC", MAPVAL + UCHAR_DIACRITIC); - addValue(BINARY_PROPERTY_MAP, "EXT", "EXTENDER", MAPVAL + UCHAR_EXTENDER); - addValue(BINARY_PROPERTY_MAP, "COMPEX", "FULLCOMPOSITIONEXCLUSION", MAPVAL + UCHAR_FULL_COMPOSITION_EXCLUSION); - addValue(BINARY_PROPERTY_MAP, "GRBASE", "GRAPHEMEBASE", MAPVAL + UCHAR_GRAPHEME_BASE); - addValue(BINARY_PROPERTY_MAP, "GREXT", "GRAPHEMEEXTEND", MAPVAL + UCHAR_GRAPHEME_EXTEND); - addValue(BINARY_PROPERTY_MAP, "GRLINK", "GRAPHEMELINK", MAPVAL + UCHAR_GRAPHEME_LINK); - addValue(BINARY_PROPERTY_MAP, "HEX", "HEXDIGIT", MAPVAL + UCHAR_HEX_DIGIT); - addValue(BINARY_PROPERTY_MAP, "HYPHEN", "", MAPVAL + UCHAR_HYPHEN); - addValue(BINARY_PROPERTY_MAP, "IDC", "IDCONTINUE", MAPVAL + UCHAR_ID_CONTINUE); - addValue(BINARY_PROPERTY_MAP, "IDS", "IDSTART", MAPVAL + UCHAR_ID_START); - addValue(BINARY_PROPERTY_MAP, "IDEO", "IDEOGRAPHIC", MAPVAL + UCHAR_IDEOGRAPHIC); - addValue(BINARY_PROPERTY_MAP, "IDSB", "IDSBINARYOPERATOR", MAPVAL + UCHAR_IDS_BINARY_OPERATOR); - addValue(BINARY_PROPERTY_MAP, "IDST", "IDSTRINARYOPERATOR", MAPVAL + UCHAR_IDS_TRINARY_OPERATOR); - addValue(BINARY_PROPERTY_MAP, "JOINC", "JOINCONTROL", MAPVAL + UCHAR_JOIN_CONTROL); - addValue(BINARY_PROPERTY_MAP, "LOE", "LOGICALORDEREXCEPTION", MAPVAL + UCHAR_LOGICAL_ORDER_EXCEPTION); - addValue(BINARY_PROPERTY_MAP, "LOWER", "LOWERCASE", MAPVAL + UCHAR_LOWERCASE); - addValue(BINARY_PROPERTY_MAP, "MATH", "", MAPVAL + UCHAR_MATH); - addValue(BINARY_PROPERTY_MAP, "NCHAR", "NONCHARACTERCODEPOINT", MAPVAL + UCHAR_NONCHARACTER_CODE_POINT); - addValue(BINARY_PROPERTY_MAP, "QMARK", "QUOTATIONMARK", MAPVAL + UCHAR_QUOTATION_MARK); - addValue(BINARY_PROPERTY_MAP, "RADICAL", "", MAPVAL + UCHAR_RADICAL); - addValue(BINARY_PROPERTY_MAP, "SD", "SOFTDOTTED", MAPVAL + UCHAR_SOFT_DOTTED); - addValue(BINARY_PROPERTY_MAP, "TERM", "TERMINALPUNCTUATION", MAPVAL + UCHAR_TERMINAL_PUNCTUATION); - addValue(BINARY_PROPERTY_MAP, "UIDEO", "UNIFIEDIDEOGRAPH", MAPVAL + UCHAR_UNIFIED_IDEOGRAPH); - addValue(BINARY_PROPERTY_MAP, "UPPER", "UPPERCASE", MAPVAL + UCHAR_UPPERCASE); - addValue(BINARY_PROPERTY_MAP, "WSPACE", "WHITESPACE", MAPVAL + UCHAR_WHITE_SPACE); - addValue(BINARY_PROPERTY_MAP, "XIDC", "XIDCONTINUE", MAPVAL + UCHAR_XID_CONTINUE); - addValue(BINARY_PROPERTY_MAP, "XIDS", "XIDSTART", MAPVAL + UCHAR_XID_START); + ADDVALUE(BINARY_PROPERTY_MAP, "ALPHA", "ALPHABETIC", MAPVAL + UCHAR_ALPHABETIC); + ADDVALUE(BINARY_PROPERTY_MAP, "AHEX", "ASCII_HEXDIGIT", MAPVAL + UCHAR_ASCII_HEX_DIGIT); + ADDVALUE(BINARY_PROPERTY_MAP, "BIDIC", "BIDICONTROL", MAPVAL + UCHAR_BIDI_CONTROL); + ADDVALUE(BINARY_PROPERTY_MAP, "BIDIM", "BIDIMIRRORED", MAPVAL + UCHAR_BIDI_MIRRORED); + ADDVALUE(BINARY_PROPERTY_MAP, "DASH", "", MAPVAL + UCHAR_DASH); + ADDVALUE(BINARY_PROPERTY_MAP, "DI", "DEFAULTIGNORABLECODEPOINT", MAPVAL + UCHAR_DEFAULT_IGNORABLE_CODE_POINT); + ADDVALUE(BINARY_PROPERTY_MAP, "DEP", "DEPRECATED", MAPVAL + UCHAR_DEPRECATED); + ADDVALUE(BINARY_PROPERTY_MAP, "DIA", "DIACRITIC", MAPVAL + UCHAR_DIACRITIC); + ADDVALUE(BINARY_PROPERTY_MAP, "EXT", "EXTENDER", MAPVAL + UCHAR_EXTENDER); + ADDVALUE(BINARY_PROPERTY_MAP, "COMPEX", "FULLCOMPOSITIONEXCLUSION", MAPVAL + UCHAR_FULL_COMPOSITION_EXCLUSION); + ADDVALUE(BINARY_PROPERTY_MAP, "GRBASE", "GRAPHEMEBASE", MAPVAL + UCHAR_GRAPHEME_BASE); + ADDVALUE(BINARY_PROPERTY_MAP, "GREXT", "GRAPHEMEEXTEND", MAPVAL + UCHAR_GRAPHEME_EXTEND); + ADDVALUE(BINARY_PROPERTY_MAP, "GRLINK", "GRAPHEMELINK", MAPVAL + UCHAR_GRAPHEME_LINK); + ADDVALUE(BINARY_PROPERTY_MAP, "HEX", "HEXDIGIT", MAPVAL + UCHAR_HEX_DIGIT); + ADDVALUE(BINARY_PROPERTY_MAP, "HYPHEN", "", MAPVAL + UCHAR_HYPHEN); + ADDVALUE(BINARY_PROPERTY_MAP, "IDC", "IDCONTINUE", MAPVAL + UCHAR_ID_CONTINUE); + ADDVALUE(BINARY_PROPERTY_MAP, "IDS", "IDSTART", MAPVAL + UCHAR_ID_START); + ADDVALUE(BINARY_PROPERTY_MAP, "IDEO", "IDEOGRAPHIC", MAPVAL + UCHAR_IDEOGRAPHIC); + ADDVALUE(BINARY_PROPERTY_MAP, "IDSB", "IDSBINARYOPERATOR", MAPVAL + UCHAR_IDS_BINARY_OPERATOR); + ADDVALUE(BINARY_PROPERTY_MAP, "IDST", "IDSTRINARYOPERATOR", MAPVAL + UCHAR_IDS_TRINARY_OPERATOR); + ADDVALUE(BINARY_PROPERTY_MAP, "JOINC", "JOINCONTROL", MAPVAL + UCHAR_JOIN_CONTROL); + ADDVALUE(BINARY_PROPERTY_MAP, "LOE", "LOGICALORDEREXCEPTION", MAPVAL + UCHAR_LOGICAL_ORDER_EXCEPTION); + ADDVALUE(BINARY_PROPERTY_MAP, "LOWER", "LOWERCASE", MAPVAL + UCHAR_LOWERCASE); + ADDVALUE(BINARY_PROPERTY_MAP, "MATH", "", MAPVAL + UCHAR_MATH); + ADDVALUE(BINARY_PROPERTY_MAP, "NCHAR", "NONCHARACTERCODEPOINT", MAPVAL + UCHAR_NONCHARACTER_CODE_POINT); + ADDVALUE(BINARY_PROPERTY_MAP, "QMARK", "QUOTATIONMARK", MAPVAL + UCHAR_QUOTATION_MARK); + ADDVALUE(BINARY_PROPERTY_MAP, "RADICAL", "", MAPVAL + UCHAR_RADICAL); + ADDVALUE(BINARY_PROPERTY_MAP, "SD", "SOFTDOTTED", MAPVAL + UCHAR_SOFT_DOTTED); + ADDVALUE(BINARY_PROPERTY_MAP, "TERM", "TERMINALPUNCTUATION", MAPVAL + UCHAR_TERMINAL_PUNCTUATION); + ADDVALUE(BINARY_PROPERTY_MAP, "UIDEO", "UNIFIEDIDEOGRAPH", MAPVAL + UCHAR_UNIFIED_IDEOGRAPH); + ADDVALUE(BINARY_PROPERTY_MAP, "UPPER", "UPPERCASE", MAPVAL + UCHAR_UPPERCASE); + ADDVALUE(BINARY_PROPERTY_MAP, "WSPACE", "WHITESPACE", MAPVAL + UCHAR_WHITE_SPACE); + ADDVALUE(BINARY_PROPERTY_MAP, "XIDC", "XIDCONTINUE", MAPVAL + UCHAR_XID_CONTINUE); + ADDVALUE(BINARY_PROPERTY_MAP, "XIDS", "XIDSTART", MAPVAL + UCHAR_XID_START); + + umtx_unlock(&PROPSET_MUTEX); } U_NAMESPACE_END