Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | ******************************************************************************* |
michael@0 | 3 | * |
michael@0 | 4 | * Copyright (C) 2000-2011, International Business Machines |
michael@0 | 5 | * Corporation and others. All Rights Reserved. |
michael@0 | 6 | * |
michael@0 | 7 | ******************************************************************************* |
michael@0 | 8 | * file name: ucol_elm.h |
michael@0 | 9 | * encoding: US-ASCII |
michael@0 | 10 | * tab size: 8 (not used) |
michael@0 | 11 | * indentation:4 |
michael@0 | 12 | * |
michael@0 | 13 | * created 02/22/2001 |
michael@0 | 14 | * created by: Vladimir Weinstein |
michael@0 | 15 | * |
michael@0 | 16 | * This program reads the Franctional UCA table and generates |
michael@0 | 17 | * internal format for UCA table as well as inverse UCA table. |
michael@0 | 18 | * It then writes binary files containing the data: ucadata.dat |
michael@0 | 19 | * & invuca.dat |
michael@0 | 20 | */ |
michael@0 | 21 | #ifndef UCOL_UCAELEMS_H |
michael@0 | 22 | #define UCOL_UCAELEMS_H |
michael@0 | 23 | |
michael@0 | 24 | #include "unicode/utypes.h" |
michael@0 | 25 | #include "unicode/uniset.h" |
michael@0 | 26 | #include "ucol_tok.h" |
michael@0 | 27 | |
michael@0 | 28 | #if !UCONFIG_NO_COLLATION |
michael@0 | 29 | |
michael@0 | 30 | #include "ucol_imp.h" |
michael@0 | 31 | |
michael@0 | 32 | #ifdef UCOL_DEBUG |
michael@0 | 33 | #include "cmemory.h" |
michael@0 | 34 | #include <stdio.h> |
michael@0 | 35 | #endif |
michael@0 | 36 | |
michael@0 | 37 | U_CDECL_BEGIN |
michael@0 | 38 | |
michael@0 | 39 | /* This is the maximum trie capacity for the mapping trie. |
michael@0 | 40 | Due to current limitations in genuca and the design of UTrie, |
michael@0 | 41 | this number can't be more than 256K. |
michael@0 | 42 | As of Unicode 5, it currently could safely go to 128K without |
michael@0 | 43 | a problem. Normally, less than 32K are tailored. |
michael@0 | 44 | */ |
michael@0 | 45 | #define UCOL_ELM_TRIE_CAPACITY 0x40000 |
michael@0 | 46 | |
michael@0 | 47 | /* This is the maxmun capacity for temparay combining class |
michael@0 | 48 | * table. The table will be compacted after scanning all the |
michael@0 | 49 | * Unicode codepoints. |
michael@0 | 50 | */ |
michael@0 | 51 | #define UCOL_MAX_CM_TAB 0x10000 |
michael@0 | 52 | |
michael@0 | 53 | |
michael@0 | 54 | typedef struct { |
michael@0 | 55 | uint32_t *CEs; |
michael@0 | 56 | int32_t position; |
michael@0 | 57 | int32_t size; |
michael@0 | 58 | } ExpansionTable; |
michael@0 | 59 | |
michael@0 | 60 | typedef struct { |
michael@0 | 61 | UChar prefixChars[128]; |
michael@0 | 62 | UChar *prefix; |
michael@0 | 63 | uint32_t prefixSize; |
michael@0 | 64 | UChar uchars[128]; |
michael@0 | 65 | UChar *cPoints; |
michael@0 | 66 | uint32_t cSize; /* Number of characters in sequence - for contraction */ |
michael@0 | 67 | uint32_t noOfCEs; /* Number of collation elements */ |
michael@0 | 68 | uint32_t CEs[128]; /* These are collation elements - there could be more than one - in case of expansion */ |
michael@0 | 69 | uint32_t mapCE; /* This is the value element maps in original table */ |
michael@0 | 70 | uint32_t sizePrim[128]; |
michael@0 | 71 | uint32_t sizeSec[128]; |
michael@0 | 72 | uint32_t sizeTer[128]; |
michael@0 | 73 | UBool caseBit; |
michael@0 | 74 | UBool isThai; |
michael@0 | 75 | } UCAElements; |
michael@0 | 76 | |
michael@0 | 77 | typedef struct { |
michael@0 | 78 | uint32_t *endExpansionCE; |
michael@0 | 79 | UBool *isV; |
michael@0 | 80 | int32_t position; |
michael@0 | 81 | int32_t size; |
michael@0 | 82 | uint8_t maxLSize; |
michael@0 | 83 | uint8_t maxVSize; |
michael@0 | 84 | uint8_t maxTSize; |
michael@0 | 85 | } MaxJamoExpansionTable; |
michael@0 | 86 | |
michael@0 | 87 | typedef struct { |
michael@0 | 88 | uint32_t *endExpansionCE; |
michael@0 | 89 | uint8_t *expansionCESize; |
michael@0 | 90 | int32_t position; |
michael@0 | 91 | int32_t size; |
michael@0 | 92 | } MaxExpansionTable; |
michael@0 | 93 | |
michael@0 | 94 | typedef struct { |
michael@0 | 95 | uint16_t index[256]; /* index of cPoints by combining class 0-255. */ |
michael@0 | 96 | UChar *cPoints; /* code point array of all combining marks */ |
michael@0 | 97 | uint32_t size; /* total number of combining marks */ |
michael@0 | 98 | } CombinClassTable; |
michael@0 | 99 | |
michael@0 | 100 | typedef struct { |
michael@0 | 101 | /*CompactEIntArray *mapping; */ |
michael@0 | 102 | UNewTrie *mapping; |
michael@0 | 103 | ExpansionTable *expansions; |
michael@0 | 104 | struct CntTable *contractions; |
michael@0 | 105 | UCATableHeader *image; |
michael@0 | 106 | UColOptionSet *options; |
michael@0 | 107 | MaxExpansionTable *maxExpansions; |
michael@0 | 108 | MaxJamoExpansionTable *maxJamoExpansions; |
michael@0 | 109 | uint8_t *unsafeCP; |
michael@0 | 110 | uint8_t *contrEndCP; |
michael@0 | 111 | const UCollator *UCA; |
michael@0 | 112 | UHashtable *prefixLookup; |
michael@0 | 113 | CombinClassTable *cmLookup; /* combining class lookup for tailoring. */ |
michael@0 | 114 | } tempUCATable; |
michael@0 | 115 | |
michael@0 | 116 | typedef struct { |
michael@0 | 117 | UChar cp; |
michael@0 | 118 | uint16_t cClass; // combining class |
michael@0 | 119 | }CompData; |
michael@0 | 120 | |
michael@0 | 121 | typedef struct { |
michael@0 | 122 | CompData *precomp; |
michael@0 | 123 | int32_t precompLen; |
michael@0 | 124 | UChar *decomp; |
michael@0 | 125 | int32_t decompLen; |
michael@0 | 126 | UChar *comp; |
michael@0 | 127 | int32_t compLen; |
michael@0 | 128 | uint16_t curClass; |
michael@0 | 129 | uint16_t tailoringCM; |
michael@0 | 130 | int32_t cmPos; |
michael@0 | 131 | }tempTailorContext; |
michael@0 | 132 | |
michael@0 | 133 | U_CAPI tempUCATable * U_EXPORT2 uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UColCETags supplementaryInitTag, UErrorCode *status); |
michael@0 | 134 | U_CAPI void U_EXPORT2 uprv_uca_closeTempTable(tempUCATable *t); |
michael@0 | 135 | U_CAPI uint32_t U_EXPORT2 uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status); |
michael@0 | 136 | U_CAPI UCATableHeader * U_EXPORT2 uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status); |
michael@0 | 137 | |
michael@0 | 138 | U_CAPI int32_t U_EXPORT2 |
michael@0 | 139 | uprv_uca_canonicalClosure(tempUCATable *t, UColTokenParser *src, |
michael@0 | 140 | icu::UnicodeSet *closed, UErrorCode *status); |
michael@0 | 141 | |
michael@0 | 142 | U_CDECL_END |
michael@0 | 143 | |
michael@0 | 144 | #endif /* #if !UCONFIG_NO_COLLATION */ |
michael@0 | 145 | |
michael@0 | 146 | #endif |