]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/ucol_elm.h
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / i18n / ucol_elm.h
1 /*
2 *******************************************************************************
3 *
4 * Copyright (C) 2000-2003, International Business Machines
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"
25
26 #if !UCONFIG_NO_COLLATION
27
28 #include "ucol_cnt.h"
29 #include "ucol_imp.h"
30
31 #ifdef UCOL_DEBUG
32 #include "cmemory.h"
33 #include <stdio.h>
34 #endif
35
36 U_NAMESPACE_BEGIN
37
38 typedef struct {
39 uint32_t *CEs;
40 int32_t position;
41 int32_t size;
42 } ExpansionTable;
43
44 typedef struct {
45 UChar prefixChars[128];
46 UChar *prefix;
47 uint32_t prefixSize;
48 UChar uchars[128];
49 UChar *cPoints;
50 uint32_t cSize; /* Number of characters in sequence - for contraction */
51 uint32_t noOfCEs; /* Number of collation elements */
52 uint32_t CEs[128]; /* These are collation elements - there could be more than one - in case of expansion */
53 uint32_t mapCE; /* This is the value element maps in original table */
54 uint32_t sizePrim[128];
55 uint32_t sizeSec[128];
56 uint32_t sizeTer[128];
57 UBool variableTop;
58 UBool caseBit;
59 UBool isThai;
60 } UCAElements;
61
62 typedef struct {
63 uint32_t *endExpansionCE;
64 UBool *isV;
65 int position;
66 int size;
67 uint8_t maxLSize;
68 uint8_t maxVSize;
69 uint8_t maxTSize;
70 } MaxJamoExpansionTable;
71
72 typedef struct {
73 uint32_t *endExpansionCE;
74 uint8_t *expansionCESize;
75 int position;
76 int size;
77 } MaxExpansionTable;
78
79 typedef struct {
80 /*CompactEIntArray *mapping; */
81 UNewTrie *mapping;
82 ExpansionTable *expansions;
83 struct CntTable *contractions;
84 UCATableHeader *image;
85 UColOptionSet *options;
86 MaxExpansionTable *maxExpansions;
87 MaxJamoExpansionTable *maxJamoExpansions;
88 uint8_t *unsafeCP;
89 uint8_t *contrEndCP;
90 const UCollator *UCA;
91 UHashtable *prefixLookup;
92 } tempUCATable;
93
94 U_CAPI tempUCATable * U_EXPORT2 uprv_uca_initTempTable(UCATableHeader *image, UColOptionSet *opts, const UCollator *UCA, UColCETags initTag, UColCETags supplementaryInitTag, UErrorCode *status);
95 U_CAPI tempUCATable * U_EXPORT2 uprv_uca_cloneTempTable(tempUCATable *t, UErrorCode *status);
96 U_CAPI void U_EXPORT2 uprv_uca_closeTempTable(tempUCATable *t);
97 U_CAPI uint32_t U_EXPORT2 uprv_uca_addAnElement(tempUCATable *t, UCAElements *element, UErrorCode *status);
98 U_CAPI UCATableHeader * U_EXPORT2 uprv_uca_assembleTable(tempUCATable *t, UErrorCode *status);
99 U_CAPI int32_t U_EXPORT2
100 uprv_uca_canonicalClosure(tempUCATable *t, UErrorCode *status);
101
102
103 #define paddedsize(something) ((something)+((((something)%4)!=0)?(4-(something)%4):0))
104 #define headersize (paddedsize(sizeof(UCATableHeader))+paddedsize(sizeof(UColOptionSet)))
105
106 U_NAMESPACE_END
107
108 #endif /* #if !UCONFIG_NO_COLLATION */
109
110 #endif