]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ******************************************************************************* | |
3 | * | |
73c04bcf | 4 | * Copyright (C) 2003-2006, International Business Machines |
b75a7d8f A |
5 | * Corporation and others. All Rights Reserved. |
6 | * | |
7 | ******************************************************************************* | |
8 | * file name: sprpimpl.h | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2003feb1 | |
14 | * created by: Ram Viswanadha | |
15 | */ | |
16 | ||
17 | #ifndef SPRPIMPL_H | |
18 | #define SPRPIMPL_H | |
19 | ||
20 | #include "unicode/utypes.h" | |
374ca955 A |
21 | |
22 | #if !UCONFIG_NO_IDNA | |
23 | ||
b75a7d8f A |
24 | #include "unicode/ustring.h" |
25 | #include "unicode/parseerr.h" | |
374ca955 A |
26 | #include "unicode/usprep.h" |
27 | #include "unicode/udata.h" | |
28 | #include "utrie.h" | |
29 | #include "udataswp.h" | |
73c04bcf | 30 | #include "ubidi_props.h" |
b75a7d8f | 31 | |
374ca955 A |
32 | #define _SPREP_DATA_TYPE "spp" |
33 | ||
34 | enum UStringPrepType{ | |
35 | USPREP_UNASSIGNED = 0x0000 , | |
36 | USPREP_MAP = 0x0001 , | |
37 | USPREP_PROHIBITED = 0x0002 , | |
38 | USPREP_DELETE = 0x0003 , | |
39 | USPREP_TYPE_LIMIT = 0x0004 | |
40 | }; | |
41 | ||
42 | typedef enum UStringPrepType UStringPrepType; | |
43 | ||
44 | #ifdef USPREP_TYPE_NAMES_ARRAY | |
45 | static const char* usprepTypeNames[] ={ | |
46 | "UNASSIGNED" , | |
47 | "MAP" , | |
48 | "PROHIBITED" , | |
49 | "DELETE", | |
50 | "TYPE_LIMIT" | |
51 | }; | |
52 | #endif | |
b75a7d8f A |
53 | |
54 | enum{ | |
374ca955 A |
55 | _SPREP_NORMALIZATION_ON = 0x0001, |
56 | _SPREP_CHECK_BIDI_ON = 0x0002 | |
b75a7d8f | 57 | }; |
374ca955 | 58 | |
b75a7d8f | 59 | enum{ |
374ca955 A |
60 | _SPREP_TYPE_THRESHOLD = 0xFFF0, |
61 | _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/ | |
62 | _SPREP_MAX_INDEX_TOP_LENGTH = 0x0003 | |
b75a7d8f | 63 | }; |
374ca955 | 64 | |
b75a7d8f A |
65 | /* indexes[] value names */ |
66 | enum { | |
374ca955 A |
67 | _SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */ |
68 | _SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */ | |
69 | _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */ | |
70 | _SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */ | |
71 | _SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */ | |
72 | _SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */ | |
73 | _SPREP_FOUR_UCHARS_MAPPING_INDEX_START = 6, /* The starting index of 4 UChars mapping index in the mapping data array */ | |
74 | _SPREP_OPTIONS = 7, /* Bit set of options to turn on in the profile */ | |
75 | _SPREP_INDEX_TOP=16 /* changing this requires a new formatVersion */ | |
b75a7d8f A |
76 | }; |
77 | ||
374ca955 A |
78 | typedef struct UStringPrepKey UStringPrepKey; |
79 | ||
80 | ||
81 | struct UStringPrepKey{ | |
82 | char* name; | |
83 | char* path; | |
84 | }; | |
85 | ||
86 | struct UStringPrepProfile{ | |
87 | int32_t indexes[_SPREP_INDEX_TOP]; | |
88 | UTrie sprepTrie; | |
89 | const uint16_t* mappingData; | |
90 | UDataMemory* sprepData; | |
73c04bcf | 91 | const UBiDiProps *bdp; /* used only if checkBiDi is set */ |
374ca955 | 92 | int32_t refCount; |
73c04bcf | 93 | UBool isDataLoaded; |
374ca955 A |
94 | UBool doNFKC; |
95 | UBool checkBiDi; | |
b75a7d8f A |
96 | }; |
97 | ||
374ca955 A |
98 | /** |
99 | * Helper function for populating the UParseError struct | |
100 | * @internal | |
101 | */ | |
102 | U_CAPI void U_EXPORT2 | |
103 | uprv_syntaxError(const UChar* rules, | |
b75a7d8f A |
104 | int32_t pos, |
105 | int32_t rulesLen, | |
374ca955 | 106 | UParseError* parseError); |
b75a7d8f | 107 | |
374ca955 A |
108 | |
109 | /** | |
110 | * Swap StringPrep .spp profile data. See udataswp.h. | |
111 | * @internal | |
112 | */ | |
113 | U_CAPI int32_t U_EXPORT2 | |
114 | usprep_swap(const UDataSwapper *ds, | |
115 | const void *inData, int32_t length, void *outData, | |
116 | UErrorCode *pErrorCode); | |
b75a7d8f A |
117 | |
118 | #endif /* #if !UCONFIG_NO_IDNA */ | |
119 | ||
120 | #endif | |
121 | ||
122 | /* | |
123 | * Hey, Emacs, please set the following: | |
124 | * | |
125 | * Local Variables: | |
126 | * indent-tabs-mode: nil | |
127 | * End: | |
128 | * | |
129 | */ |