1 /* 2 ******************************************************************************* 3 * Copyright (C) 2000-2011, International Business Machines 4 * Corporation and others. All Rights Reserved. 5 ******************************************************************************* 6 * file name: ucol_data.h 7 * encoding: US-ASCII 8 * tab size: 8 (not used) 9 * indentation:4 10 * 11 * created on: 2011jul02 12 * created by: Markus Scherer 13 * 14 * Private implementation header for C/C++ collation. 15 * Some file data structure definitions were moved here from i18n/ucol_imp.h 16 * so that the common library (via ucol_swp.cpp) need not depend on the i18n library at all. 17 * 18 * We do not want to move the collation swapper to the i18n library because 19 * a) the resource bundle swapper depends on it and would have to move too, and 20 * b) we might want to eventually implement runtime data swapping, 21 * which might (or might not) be easier if all swappers are in the common library. 22 */ 23 24 #ifndef __UCOL_DATA_H__ 25 #define __UCOL_DATA_H__ 26 27 #include "unicode/utypes.h" 28 29 #if !UCONFIG_NO_COLLATION 30 31 /* let us know whether reserved fields are reset to zero or junked */ 32 #define UCOL_HEADER_MAGIC 0x20030618 33 34 typedef struct { 35 int32_t size; 36 /* all the offsets are in bytes */ 37 /* to get the address add to the header address and cast properly */ 38 uint32_t options; /* these are the default options for the collator */ 39 uint32_t UCAConsts; /* structure which holds values for indirect positioning and implicit ranges */ 40 uint32_t contractionUCACombos; /* this one is needed only for UCA, to copy the appropriate contractions */ 41 uint32_t magic; /* magic number - lets us know whether reserved data is reset or junked */ 42 uint32_t mappingPosition; /* const uint8_t *mappingPosition; */ 43 uint32_t expansion; /* uint32_t *expansion; */ 44 uint32_t contractionIndex; /* UChar *contractionIndex; */ 45 uint32_t contractionCEs; /* uint32_t *contractionCEs; */ 46 uint32_t contractionSize; /* needed for various closures */ 47 /*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars */ 48 49 uint32_t endExpansionCE; /* array of last collation element in 50 expansion */ 51 uint32_t expansionCESize; /* array of maximum expansion size 52 corresponding to the expansion 53 collation elements with last element 54 in endExpansionCE*/ 55 int32_t endExpansionCECount; /* size of endExpansionCE */ 56 uint32_t unsafeCP; /* hash table of unsafe code points */ 57 uint32_t contrEndCP; /* hash table of final code points */ 58 /* in contractions. */ 59 60 int32_t contractionUCACombosSize; /* number of UCA contraction items. */ 61 /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */ 62 UBool jamoSpecial; /* is jamoSpecial */ 63 UBool isBigEndian; /* is this data big endian? from the UDataInfo header*/ 64 uint8_t charSetFamily; /* what is the charset family of this data from the UDataInfo header*/ 65 uint8_t contractionUCACombosWidth; /* width of UCA combos field */ 66 UVersionInfo version; 67 UVersionInfo UCAVersion; /* version of the UCA, read from file */ 68 UVersionInfo UCDVersion; /* UCD version, obtained by u_getUnicodeVersion */ 69 UVersionInfo formatVersion; /* format version from the UDataInfo header */ 70 uint32_t scriptToLeadByte; /* offset to script to lead collation byte mapping data */ 71 uint32_t leadByteToScript; /* offset to lead collation byte to script mapping data */ 72 uint8_t reserved[76]; /* for future use */ 73 } UCATableHeader; 74 75 typedef struct { 76 uint32_t byteSize; 77 uint32_t tableSize; 78 uint32_t contsSize; 79 uint32_t table; 80 uint32_t conts; 81 UVersionInfo UCAVersion; /* version of the UCA, read from file */ 82 uint8_t padding[8]; 83 } InverseUCATableHeader; 84 85 #endif /* !UCONFIG_NO_COLLATION */ 86 87 #endif /* __UCOL_DATA_H__ */ 88