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