X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..ba516feee23ef0c2b810ac6365e88f33807caaa8:/icuSources/i18n/ucol_elm.h diff --git a/icuSources/i18n/ucol_elm.h b/icuSources/i18n/ucol_elm.h index ef07c553..e200b51c 100644 --- a/icuSources/i18n/ucol_elm.h +++ b/icuSources/i18n/ucol_elm.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2000-2001, International Business Machines +* Copyright (C) 2000-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -22,10 +22,11 @@ #define UCOL_UCAELEMS_H #include "unicode/utypes.h" +#include "unicode/uniset.h" +#include "ucol_tok.h" #if !UCONFIG_NO_COLLATION -#include "ucol_cnt.h" #include "ucol_imp.h" #ifdef UCOL_DEBUG @@ -33,7 +34,22 @@ #include #endif -U_NAMESPACE_BEGIN +U_CDECL_BEGIN + +/* This is the maximum trie capacity for the mapping trie. +Due to current limitations in genuca and the design of UTrie, +this number can't be more than 256K. +As of Unicode 5, it currently could safely go to 128K without +a problem. Normally, less than 32K are tailored. +*/ +#define UCOL_ELM_TRIE_CAPACITY 0x40000 + +/* This is the maxmun capacity for temparay combining class + * table. The table will be compacted after scanning all the + * Unicode codepoints. +*/ +#define UCOL_MAX_CM_TAB 0x10000 + typedef struct { uint32_t *CEs; @@ -54,7 +70,6 @@ typedef struct { uint32_t sizePrim[128]; uint32_t sizeSec[128]; uint32_t sizeTer[128]; - UBool variableTop; UBool caseBit; UBool isThai; } UCAElements; @@ -62,8 +77,8 @@ typedef struct { typedef struct { uint32_t *endExpansionCE; UBool *isV; - int position; - int size; + int32_t position; + int32_t size; uint8_t maxLSize; uint8_t maxVSize; uint8_t maxTSize; @@ -72,10 +87,16 @@ typedef struct { typedef struct { uint32_t *endExpansionCE; uint8_t *expansionCESize; - int position; - int size; + int32_t position; + int32_t size; } MaxExpansionTable; +typedef struct { + uint16_t index[256]; /* index of cPoints by combining class 0-255. */ + UChar *cPoints; /* code point array of all combining marks */ + uint32_t size; /* total number of combining marks */ +} CombinClassTable; + typedef struct { /*CompactEIntArray *mapping; */ UNewTrie *mapping; @@ -89,21 +110,36 @@ typedef struct { uint8_t *contrEndCP; const UCollator *UCA; UHashtable *prefixLookup; + CombinClassTable *cmLookup; /* combining class lookup for tailoring. */ } tempUCATable; -U_CAPI tempUCATable * U_EXPORT2 uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UErrorCode *status); -U_CAPI tempUCATable * U_EXPORT2 uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status); +typedef struct { + UChar cp; + uint16_t cClass; // combining class +}CompData; + +typedef struct { + CompData *precomp; + int32_t precompLen; + UChar *decomp; + int32_t decompLen; + UChar *comp; + int32_t compLen; + uint16_t curClass; + uint16_t tailoringCM; + int32_t cmPos; +}tempTailorContext; + +U_CAPI tempUCATable * U_EXPORT2 uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UColCETags supplementaryInitTag, UErrorCode *status); U_CAPI void U_EXPORT2 uprv_uca_closeTempTable(tempUCATable *t); U_CAPI uint32_t U_EXPORT2 uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status); U_CAPI UCATableHeader * U_EXPORT2 uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status); -U_CAPI int32_t U_EXPORT2 -uprv_uca_canonicalClosure(tempUCATable *t, UErrorCode *status); - -#define paddedsize(something) ((something)+((((something)%4)!=0)?(4-(something)%4):0)) -#define headersize (paddedsize(sizeof(UCATableHeader))+paddedsize(sizeof(UColOptionSet))) +U_CAPI int32_t U_EXPORT2 +uprv_uca_canonicalClosure(tempUCATable *t, UColTokenParser *src, + icu::UnicodeSet *closed, UErrorCode *status); -U_NAMESPACE_END +U_CDECL_END #endif /* #if !UCONFIG_NO_COLLATION */