1 /* 2 ******************************************************************************* 3 * 4 * Copyright (C) 2004-2005, International Business Machines 5 * Corporation and others. All Rights Reserved. 6 * 7 ******************************************************************************* 8 * file name: gencase.h 9 * encoding: US-ASCII 10 * tab size: 8 (not used) 11 * indentation:4 12 * 13 * created on: 2004aug28 14 * created by: Markus W. Scherer 15 */ 16 17 #ifndef __GENCASE_H__ 18 #define __GENCASE_H__ 19 20 #include "unicode/utypes.h" 21 #include "utrie.h" 22 #include "ucase.h" 23 24 U_CDECL_BEGIN 25 26 /* Unicode versions --------------------------------------------------------- */ 27 28 enum { 29 UNI_1_0, 30 UNI_1_1, 31 UNI_2_0, 32 UNI_3_0, 33 UNI_3_1, 34 UNI_3_2, 35 UNI_4_0, 36 UNI_4_0_1, 37 UNI_4_1, 38 UNI_VER_COUNT 39 }; 40 41 extern int32_t ucdVersion; 42 43 /* gencase ------------------------------------------------------------------ */ 44 45 #define UGENCASE_EXC_SHIFT 16 46 #define UGENCASE_EXC_MASK 0xffff0000 47 48 /* 49 * Values for the ucase.icu unfold[] data array, see store.c. 50 * The values are stored in ucase.icu so that the runtime code will work with 51 * changing values, but they are hardcoded for gencase for simplicity. 52 * They are optimized, that is, provide for minimal table column widths, 53 * for the actual Unicode data, so that the table size is minimized. 54 * Future versions of Unicode may require increases of some of these values. 55 */ 56 enum { 57 UGENCASE_UNFOLD_STRING_WIDTH=3, 58 UGENCASE_UNFOLD_CP_WIDTH=2, 59 UGENCASE_UNFOLD_WIDTH=UGENCASE_UNFOLD_STRING_WIDTH+UGENCASE_UNFOLD_CP_WIDTH, 60 UGENCASE_UNFOLD_MAX_ROWS=250 61 }; 62 63 /* Values for additional data stored in pv column 1 */ 64 enum { 65 UGENCASE_IS_MID_LETTER_SHIFT /* bit 0 */ 66 }; 67 68 /* special casing data */ 69 typedef struct { 70 UChar32 code; 71 UBool isComplex; 72 UChar lowerCase[32], upperCase[32], titleCase[32]; 73 } SpecialCasing; 74 75 /* case folding data */ 76 typedef struct { 77 UChar32 code, simple; 78 char status; 79 UChar full[32]; 80 } CaseFolding; 81 82 /* case mapping properties */ 83 typedef struct { 84 UChar32 code, lowerCase, upperCase, titleCase; 85 UChar32 closure[8]; 86 SpecialCasing *specialCasing; 87 CaseFolding *caseFolding; 88 uint8_t gc, cc; 89 } Props; 90 91 /* global flags */ 92 extern UBool beVerbose, haveCopyright; 93 94 /* properties vectors in gencase.c */ 95 extern uint32_t *pv; 96 97 /* prototypes */ 98 U_CFUNC void 99 writeUCDFilename(char *basename, const char *filename, const char *suffix); 100 101 U_CFUNC UBool 102 isToken(const char *token, const char *s); 103 104 extern void 105 setUnicodeVersion(const char *v); 106 107 extern void 108 setProps(Props *p); 109 110 U_CFUNC uint32_t U_EXPORT2 111 getFoldedPropsValue(UNewTrie *trie, UChar32 start, int32_t offset); 112 113 extern void 114 addCaseSensitive(UChar32 first, UChar32 last); 115 116 extern void 117 makeCaseClosure(void); 118 119 extern void 120 makeExceptions(void); 121 122 extern void 123 generateData(const char *dataDir, UBool csource); 124 125 U_CDECL_END 126 127 #endif 128