1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/ucnv_ext.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,479 @@ 1.4 +/* 1.5 +****************************************************************************** 1.6 +* 1.7 +* Copyright (C) 2003-2013, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +****************************************************************************** 1.11 +* file name: ucnv_ext.h 1.12 +* encoding: US-ASCII 1.13 +* tab size: 8 (not used) 1.14 +* indentation:4 1.15 +* 1.16 +* created on: 2003jun13 1.17 +* created by: Markus W. Scherer 1.18 +* 1.19 +* Conversion extensions 1.20 +*/ 1.21 + 1.22 +#ifndef __UCNV_EXT_H__ 1.23 +#define __UCNV_EXT_H__ 1.24 + 1.25 +#include "unicode/utypes.h" 1.26 + 1.27 +#if !UCONFIG_NO_CONVERSION 1.28 + 1.29 +#include "unicode/ucnv.h" 1.30 +#include "ucnv_cnv.h" 1.31 + 1.32 +/* 1.33 + * See icuhtml/design/conversion/conversion_extensions.html 1.34 + * 1.35 + * Conversion extensions serve three purposes: 1.36 + * 1. They support m:n mappings. 1.37 + * 2. They support extension-only conversion files that are used together 1.38 + * with the regular conversion data in base files. 1.39 + * 3. They support mappings with more complicated meta data, 1.40 + * for example "good one-way" mappings (|4). 1.41 + * 1.42 + * A base file may contain an extension table (explicitly requested or 1.43 + * implicitly generated for m:n mappings), but its extension table is not 1.44 + * used when an extension-only file is used. 1.45 + * 1.46 + * It is an error if a base file contains any regular (not extension) mapping 1.47 + * from the same sequence as a mapping in the extension file 1.48 + * because the base mapping would hide the extension mapping. 1.49 + * 1.50 + * 1.51 + * Data for conversion extensions: 1.52 + * 1.53 + * One set of data structures per conversion direction (to/from Unicode). 1.54 + * The data structures are sorted by input units to allow for binary search. 1.55 + * Input sequences of more than one unit are handled like contraction tables 1.56 + * in collation: 1.57 + * The lookup value of a unit points to another table that is to be searched 1.58 + * for the next unit, recursively. 1.59 + * 1.60 + * For conversion from Unicode, the initial code point is looked up in 1.61 + * a 3-stage trie for speed, 1.62 + * with an additional table of unique results to save space. 1.63 + * 1.64 + * Long output strings are stored in separate arrays, with length and index 1.65 + * in the lookup tables. 1.66 + * Output results also include a flag distinguishing roundtrip from 1.67 + * (reverse) fallback mappings. 1.68 + * 1.69 + * Input Unicode strings must not begin or end with unpaired surrogates 1.70 + * to avoid problems with matches on parts of surrogate pairs. 1.71 + * 1.72 + * Mappings from multiple characters (code points or codepage state 1.73 + * table sequences) must be searched preferring the longest match. 1.74 + * For this to work and be efficient, the variable-width table must contain 1.75 + * all mappings that contain prefixes of the multiple characters. 1.76 + * If an extension table is built on top of a base table in another file 1.77 + * and a base table entry is a prefix of a multi-character mapping, then 1.78 + * this is an error. 1.79 + * 1.80 + * 1.81 + * Implementation note: 1.82 + * 1.83 + * Currently, the parser and several checks in the code limit the number 1.84 + * of UChars or bytes in a mapping to 1.85 + * UCNV_EXT_MAX_UCHARS and UCNV_EXT_MAX_BYTES, respectively, 1.86 + * which are output value limits in the data structure. 1.87 + * 1.88 + * For input, this is not strictly necessary - it is a hard limit only for the 1.89 + * buffers in UConverter that are used to store partial matches. 1.90 + * 1.91 + * Input sequences could otherwise be arbitrarily long if partial matches 1.92 + * need not be stored (i.e., if a sequence does not span several buffers with too 1.93 + * many units before the last buffer), although then results would differ 1.94 + * depending on whether partial matches exceed the limits or not, 1.95 + * which depends on the pattern of buffer sizes. 1.96 + * 1.97 + * 1.98 + * Data structure: 1.99 + * 1.100 + * int32_t indexes[>=32]; 1.101 + * 1.102 + * Array of indexes and lengths etc. The length of the array is at least 32. 1.103 + * The actual length is stored in indexes[0] to be forward compatible. 1.104 + * 1.105 + * Each index to another array is the number of bytes from indexes[]. 1.106 + * Each length of an array is the number of array base units in that array. 1.107 + * 1.108 + * Some of the structures may not be present, in which case their indexes 1.109 + * and lengths are 0. 1.110 + * 1.111 + * Usage of indexes[i]: 1.112 + * [0] length of indexes[] 1.113 + * 1.114 + * // to Unicode table 1.115 + * [1] index of toUTable[] (array of uint32_t) 1.116 + * [2] length of toUTable[] 1.117 + * [3] index of toUUChars[] (array of UChar) 1.118 + * [4] length of toUUChars[] 1.119 + * 1.120 + * // from Unicode table, not for the initial code point 1.121 + * [5] index of fromUTableUChars[] (array of UChar) 1.122 + * [6] index of fromUTableValues[] (array of uint32_t) 1.123 + * [7] length of fromUTableUChars[] and fromUTableValues[] 1.124 + * [8] index of fromUBytes[] (array of char) 1.125 + * [9] length of fromUBytes[] 1.126 + * 1.127 + * // from Unicode trie for initial-code point lookup 1.128 + * [10] index of fromUStage12[] (combined array of uint16_t for stages 1 & 2) 1.129 + * [11] length of stage 1 portion of fromUStage12[] 1.130 + * [12] length of fromUStage12[] 1.131 + * [13] index of fromUStage3[] (array of uint16_t indexes into fromUStage3b[]) 1.132 + * [14] length of fromUStage3[] 1.133 + * [15] index of fromUStage3b[] (array of uint32_t like fromUTableValues[]) 1.134 + * [16] length of fromUStage3b[] 1.135 + * 1.136 + * [17] Bit field containing numbers of bytes: 1.137 + * 31..24 reserved, 0 1.138 + * 23..16 maximum input bytes 1.139 + * 15.. 8 maximum output bytes 1.140 + * 7.. 0 maximum bytes per UChar 1.141 + * 1.142 + * [18] Bit field containing numbers of UChars: 1.143 + * 31..24 reserved, 0 1.144 + * 23..16 maximum input UChars 1.145 + * 15.. 8 maximum output UChars 1.146 + * 7.. 0 maximum UChars per byte 1.147 + * 1.148 + * [19] Bit field containing flags: 1.149 + * (extension table unicodeMask) 1.150 + * 1 UCNV_HAS_SURROGATES flag for the extension table 1.151 + * 0 UCNV_HAS_SUPPLEMENTARY flag for the extension table 1.152 + * 1.153 + * [20]..[30] reserved, 0 1.154 + * [31] number of bytes for the entire extension structure 1.155 + * [>31] reserved; there are indexes[0] indexes 1.156 + * 1.157 + * 1.158 + * uint32_t toUTable[]; 1.159 + * 1.160 + * Array of byte/value pairs for lookups for toUnicode conversion. 1.161 + * The array is partitioned into sections like collation contraction tables. 1.162 + * Each section contains one word with the number of following words and 1.163 + * a default value for when the lookup in this section yields no match. 1.164 + * 1.165 + * A section is sorted in ascending order of input bytes, 1.166 + * allowing for fast linear or binary searches. 1.167 + * The builder may store entries for a contiguous range of byte values 1.168 + * (compare difference between the first and last one with count), 1.169 + * which then allows for direct array access. 1.170 + * The builder should always do this for the initial table section. 1.171 + * 1.172 + * Entries may have 0 values, see below. 1.173 + * No two entries in a section have the same byte values. 1.174 + * 1.175 + * Each uint32_t contains an input byte value in bits 31..24 and the 1.176 + * corresponding lookup value in bits 23..0. 1.177 + * Interpret the value as follows: 1.178 + * if(value==0) { 1.179 + * no match, see below 1.180 + * } else if(value<0x1f0000) { 1.181 + * partial match - use value as index to the next toUTable section 1.182 + * and match the next unit; (value indexes toUTable[value]) 1.183 + * } else { 1.184 + * if(bit 23 set) { 1.185 + * roundtrip; 1.186 + * } else { 1.187 + * fallback; 1.188 + * } 1.189 + * unset value bit 23; 1.190 + * if(value<=0x2fffff) { 1.191 + * (value-0x1f0000) is a code point; (BMP: value<=0x1fffff) 1.192 + * } else { 1.193 + * bits 17..0 (value&0x3ffff) is an index to 1.194 + * the result UChars in toUUChars[]; (0 indexes toUUChars[0]) 1.195 + * length of the result=((value>>18)-12); (length=0..19) 1.196 + * } 1.197 + * } 1.198 + * 1.199 + * The first word in a section contains the number of following words in the 1.200 + * input byte position (bits 31..24, number=1..0xff). 1.201 + * The value of the initial word is used when the current byte is not found 1.202 + * in this section. 1.203 + * If the value is not 0, then it represents a result as above. 1.204 + * If the value is 0, then the search has to return a shorter match with an 1.205 + * earlier default value as the result, or result in "unmappable" even for the 1.206 + * initial bytes. 1.207 + * If the value is 0 for the initial toUTable entry, then the initial byte 1.208 + * does not start any mapping input. 1.209 + * 1.210 + * 1.211 + * UChar toUUChars[]; 1.212 + * 1.213 + * Contains toUnicode mapping results, stored as sequences of UChars. 1.214 + * Indexes and lengths stored in the toUTable[]. 1.215 + * 1.216 + * 1.217 + * UChar fromUTableUChars[]; 1.218 + * uint32_t fromUTableValues[]; 1.219 + * 1.220 + * The fromUTable is split into two arrays, but works otherwise much like 1.221 + * the toUTable. The array is partitioned into sections like collation 1.222 + * contraction tables and toUTable. 1.223 + * A row in the table consists of same-index entries in fromUTableUChars[] 1.224 + * and fromUTableValues[]. 1.225 + * 1.226 + * Interpret a value as follows: 1.227 + * if(value==0) { 1.228 + * no match, see below 1.229 + * } else if(value<=0xffffff) { (bits 31..24 are 0) 1.230 + * partial match - use value as index to the next fromUTable section 1.231 + * and match the next unit; (value indexes fromUTable[value]) 1.232 + * } else { 1.233 + * if(value==0x80000001) { 1.234 + * return no mapping, but request for <subchar1>; 1.235 + * } 1.236 + * if(bit 31 set) { 1.237 + * roundtrip (|0); 1.238 + * } else if(bit 30 set) { 1.239 + * "good one-way" mapping (|4); -- new in ICU4C 51, _MBCSHeader.version 5.4/4.4 1.240 + * } else { 1.241 + * normal fallback (|1); 1.242 + * } 1.243 + * // bit 29 reserved, 0 1.244 + * length=(value>>24)&0x1f; (bits 28..24) 1.245 + * if(length==1..3) { 1.246 + * bits 23..0 contain 1..3 bytes, padded with 00s on the left; 1.247 + * } else { 1.248 + * bits 23..0 (value&0xffffff) is an index to 1.249 + * the result bytes in fromUBytes[]; (0 indexes fromUBytes[0]) 1.250 + * } 1.251 + * } 1.252 + * 1.253 + * The first pair in a section contains the number of following pairs in the 1.254 + * UChar position (16 bits, number=1..0xffff). 1.255 + * The value of the initial pair is used when the current UChar is not found 1.256 + * in this section. 1.257 + * If the value is not 0, then it represents a result as above. 1.258 + * If the value is 0, then the search has to return a shorter match with an 1.259 + * earlier default value as the result, or result in "unmappable" even for the 1.260 + * initial UChars. 1.261 + * 1.262 + * If the from Unicode trie is present, then the from Unicode search tables 1.263 + * are not used for initial code points. 1.264 + * In this case, the first entries (index 0) in the tables are not used 1.265 + * (reserved, set to 0) because a value of 0 is used in trie results 1.266 + * to indicate no mapping. 1.267 + * 1.268 + * 1.269 + * uint16_t fromUStage12[]; 1.270 + * 1.271 + * Stages 1 & 2 of a trie that maps an initial code point. 1.272 + * Indexes in stage 1 are all offset by the length of stage 1 so that the 1.273 + * same array pointer can be used for both stages. 1.274 + * If (c>>10)>=(length of stage 1) then c does not start any mapping. 1.275 + * Same bit distribution as for regular conversion tries. 1.276 + * 1.277 + * 1.278 + * uint16_t fromUStage3[]; 1.279 + * uint32_t fromUStage3b[]; 1.280 + * 1.281 + * Stage 3 of the trie. The first array simply contains indexes to the second, 1.282 + * which contains words in the same format as fromUTableValues[]. 1.283 + * Use a stage 3 granularity of 4, which allows for 256k stage 3 entries, 1.284 + * and 16-bit entries in stage 3 allow for 64k stage 3b entries. 1.285 + * The stage 3 granularity means that the stage 2 entry needs to be left-shifted. 1.286 + * 1.287 + * Two arrays are used because it is expected that more than half of the stage 3 1.288 + * entries will be zero. The 16-bit index stage 3 array saves space even 1.289 + * considering storing a total of 6 bytes per non-zero entry in both arrays 1.290 + * together. 1.291 + * Using a stage 3 granularity of >1 diminishes the compactability in that stage 1.292 + * but provides a larger effective addressing space in stage 2. 1.293 + * All but the final result stage use 16-bit entries to save space. 1.294 + * 1.295 + * fromUStage3b[] contains a zero for "no mapping" at its index 0, 1.296 + * and may contain UCNV_EXT_FROM_U_SUBCHAR1 at index 1 for "<subchar1> SUB mapping" 1.297 + * (i.e., "no mapping" with preference for <subchar1> rather than <subchar>), 1.298 + * and all other items are unique non-zero results. 1.299 + * 1.300 + * The default value of a fromUTableValues[] section that is referenced 1.301 + * _directly_ from a fromUStage3b[] item may also be UCNV_EXT_FROM_U_SUBCHAR1, 1.302 + * but this value must not occur anywhere else in fromUTableValues[] 1.303 + * because "no mapping" is always a property of a single code point, 1.304 + * never of multiple. 1.305 + * 1.306 + * 1.307 + * char fromUBytes[]; 1.308 + * 1.309 + * Contains fromUnicode mapping results, stored as sequences of chars. 1.310 + * Indexes and lengths stored in the fromUTableValues[]. 1.311 + */ 1.312 +enum { 1.313 + UCNV_EXT_INDEXES_LENGTH, /* 0 */ 1.314 + 1.315 + UCNV_EXT_TO_U_INDEX, /* 1 */ 1.316 + UCNV_EXT_TO_U_LENGTH, 1.317 + UCNV_EXT_TO_U_UCHARS_INDEX, 1.318 + UCNV_EXT_TO_U_UCHARS_LENGTH, 1.319 + 1.320 + UCNV_EXT_FROM_U_UCHARS_INDEX, /* 5 */ 1.321 + UCNV_EXT_FROM_U_VALUES_INDEX, 1.322 + UCNV_EXT_FROM_U_LENGTH, 1.323 + UCNV_EXT_FROM_U_BYTES_INDEX, 1.324 + UCNV_EXT_FROM_U_BYTES_LENGTH, 1.325 + 1.326 + UCNV_EXT_FROM_U_STAGE_12_INDEX, /* 10 */ 1.327 + UCNV_EXT_FROM_U_STAGE_1_LENGTH, 1.328 + UCNV_EXT_FROM_U_STAGE_12_LENGTH, 1.329 + UCNV_EXT_FROM_U_STAGE_3_INDEX, 1.330 + UCNV_EXT_FROM_U_STAGE_3_LENGTH, 1.331 + UCNV_EXT_FROM_U_STAGE_3B_INDEX, 1.332 + UCNV_EXT_FROM_U_STAGE_3B_LENGTH, 1.333 + 1.334 + UCNV_EXT_COUNT_BYTES, /* 17 */ 1.335 + UCNV_EXT_COUNT_UCHARS, 1.336 + UCNV_EXT_FLAGS, 1.337 + 1.338 + UCNV_EXT_RESERVED_INDEX, /* 20, moves with additional indexes */ 1.339 + 1.340 + UCNV_EXT_SIZE=31, 1.341 + UCNV_EXT_INDEXES_MIN_LENGTH=32 1.342 +}; 1.343 + 1.344 +/* get the pointer to an extension array from indexes[index] */ 1.345 +#define UCNV_EXT_ARRAY(indexes, index, itemType) \ 1.346 + ((const itemType *)((const char *)(indexes)+(indexes)[index])) 1.347 + 1.348 +#define UCNV_GET_MAX_BYTES_PER_UCHAR(indexes) \ 1.349 + ((indexes)[UCNV_EXT_COUNT_BYTES]&0xff) 1.350 + 1.351 +/* internal API ------------------------------------------------------------- */ 1.352 + 1.353 +U_CFUNC UBool 1.354 +ucnv_extInitialMatchToU(UConverter *cnv, const int32_t *cx, 1.355 + int32_t firstLength, 1.356 + const char **src, const char *srcLimit, 1.357 + UChar **target, const UChar *targetLimit, 1.358 + int32_t **offsets, int32_t srcIndex, 1.359 + UBool flush, 1.360 + UErrorCode *pErrorCode); 1.361 + 1.362 +U_CFUNC UChar32 1.363 +ucnv_extSimpleMatchToU(const int32_t *cx, 1.364 + const char *source, int32_t length, 1.365 + UBool useFallback); 1.366 + 1.367 +U_CFUNC void 1.368 +ucnv_extContinueMatchToU(UConverter *cnv, 1.369 + UConverterToUnicodeArgs *pArgs, int32_t srcIndex, 1.370 + UErrorCode *pErrorCode); 1.371 + 1.372 + 1.373 +U_CFUNC UBool 1.374 +ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx, 1.375 + UChar32 cp, 1.376 + const UChar **src, const UChar *srcLimit, 1.377 + char **target, const char *targetLimit, 1.378 + int32_t **offsets, int32_t srcIndex, 1.379 + UBool flush, 1.380 + UErrorCode *pErrorCode); 1.381 + 1.382 +U_CFUNC int32_t 1.383 +ucnv_extSimpleMatchFromU(const int32_t *cx, 1.384 + UChar32 cp, uint32_t *pValue, 1.385 + UBool useFallback); 1.386 + 1.387 +U_CFUNC void 1.388 +ucnv_extContinueMatchFromU(UConverter *cnv, 1.389 + UConverterFromUnicodeArgs *pArgs, int32_t srcIndex, 1.390 + UErrorCode *pErrorCode); 1.391 + 1.392 +/* 1.393 + * Add code points and strings to the set according to the extension mappings. 1.394 + * Limitation on the UConverterSetFilter: 1.395 + * The filters currently assume that they are used with 1:1 mappings. 1.396 + * They only apply to single input code points, and then they pass through 1.397 + * only mappings with single-charset-code results. 1.398 + * For example, the Shift-JIS filter only works for 2-byte results and tests 1.399 + * that those 2 bytes are in the JIS X 0208 range of Shift-JIS. 1.400 + */ 1.401 +U_CFUNC void 1.402 +ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData, 1.403 + const USetAdder *sa, 1.404 + UConverterUnicodeSet which, 1.405 + UConverterSetFilter filter, 1.406 + UErrorCode *pErrorCode); 1.407 + 1.408 +/* toUnicode helpers -------------------------------------------------------- */ 1.409 + 1.410 +#define UCNV_EXT_TO_U_BYTE_SHIFT 24 1.411 +#define UCNV_EXT_TO_U_VALUE_MASK 0xffffff 1.412 +#define UCNV_EXT_TO_U_MIN_CODE_POINT 0x1f0000 1.413 +#define UCNV_EXT_TO_U_MAX_CODE_POINT 0x2fffff 1.414 +#define UCNV_EXT_TO_U_ROUNDTRIP_FLAG ((uint32_t)1<<23) 1.415 +#define UCNV_EXT_TO_U_INDEX_MASK 0x3ffff 1.416 +#define UCNV_EXT_TO_U_LENGTH_SHIFT 18 1.417 +#define UCNV_EXT_TO_U_LENGTH_OFFSET 12 1.418 + 1.419 +/* maximum number of indexed UChars */ 1.420 +#define UCNV_EXT_MAX_UCHARS 19 1.421 + 1.422 +#define UCNV_EXT_TO_U_MAKE_WORD(byte, value) (((uint32_t)(byte)<<UCNV_EXT_TO_U_BYTE_SHIFT)|(value)) 1.423 + 1.424 +#define UCNV_EXT_TO_U_GET_BYTE(word) ((word)>>UCNV_EXT_TO_U_BYTE_SHIFT) 1.425 +#define UCNV_EXT_TO_U_GET_VALUE(word) ((word)&UCNV_EXT_TO_U_VALUE_MASK) 1.426 + 1.427 +#define UCNV_EXT_TO_U_IS_PARTIAL(value) ((value)<UCNV_EXT_TO_U_MIN_CODE_POINT) 1.428 +#define UCNV_EXT_TO_U_GET_PARTIAL_INDEX(value) (value) 1.429 + 1.430 +#define UCNV_EXT_TO_U_IS_ROUNDTRIP(value) (((value)&UCNV_EXT_TO_U_ROUNDTRIP_FLAG)!=0) 1.431 +#define UCNV_EXT_TO_U_MASK_ROUNDTRIP(value) ((value)&~UCNV_EXT_TO_U_ROUNDTRIP_FLAG) 1.432 + 1.433 +/* use after masking off the roundtrip flag */ 1.434 +#define UCNV_EXT_TO_U_IS_CODE_POINT(value) ((value)<=UCNV_EXT_TO_U_MAX_CODE_POINT) 1.435 +#define UCNV_EXT_TO_U_GET_CODE_POINT(value) ((value)-UCNV_EXT_TO_U_MIN_CODE_POINT) 1.436 + 1.437 +#define UCNV_EXT_TO_U_GET_INDEX(value) ((value)&UCNV_EXT_TO_U_INDEX_MASK) 1.438 +#define UCNV_EXT_TO_U_GET_LENGTH(value) (((value)>>UCNV_EXT_TO_U_LENGTH_SHIFT)-UCNV_EXT_TO_U_LENGTH_OFFSET) 1.439 + 1.440 +/* fromUnicode helpers ------------------------------------------------------ */ 1.441 + 1.442 +/* most trie constants are shared with ucnvmbcs.h */ 1.443 + 1.444 +/* see similar utrie.h UTRIE_INDEX_SHIFT and UTRIE_DATA_GRANULARITY */ 1.445 +#define UCNV_EXT_STAGE_2_LEFT_SHIFT 2 1.446 +#define UCNV_EXT_STAGE_3_GRANULARITY 4 1.447 + 1.448 +/* trie access, returns the stage 3 value=index to stage 3b; s1Index=c>>10 */ 1.449 +#define UCNV_EXT_FROM_U(stage12, stage3, s1Index, c) \ 1.450 + (stage3)[ ((int32_t)(stage12)[ (stage12)[s1Index] +(((c)>>4)&0x3f) ]<<UCNV_EXT_STAGE_2_LEFT_SHIFT) +((c)&0xf) ] 1.451 + 1.452 +#define UCNV_EXT_FROM_U_LENGTH_SHIFT 24 1.453 +#define UCNV_EXT_FROM_U_ROUNDTRIP_FLAG ((uint32_t)1<<31) 1.454 +#define UCNV_EXT_FROM_U_GOOD_ONE_WAY_FLAG 0x40000000 1.455 +#define UCNV_EXT_FROM_U_STATUS_MASK 0xc0000000 1.456 +#define UCNV_EXT_FROM_U_RESERVED_MASK 0x20000000 1.457 +#define UCNV_EXT_FROM_U_DATA_MASK 0xffffff 1.458 + 1.459 +/* special value for "no mapping" to <subchar1> (impossible roundtrip to 0 bytes, value 01) */ 1.460 +#define UCNV_EXT_FROM_U_SUBCHAR1 0x80000001 1.461 + 1.462 +/* at most 3 bytes in the lower part of the value */ 1.463 +#define UCNV_EXT_FROM_U_MAX_DIRECT_LENGTH 3 1.464 + 1.465 +/* maximum number of indexed bytes */ 1.466 +#define UCNV_EXT_MAX_BYTES 0x1f 1.467 + 1.468 +#define UCNV_EXT_FROM_U_IS_PARTIAL(value) (((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)==0) 1.469 +#define UCNV_EXT_FROM_U_GET_PARTIAL_INDEX(value) (value) 1.470 + 1.471 +#define UCNV_EXT_FROM_U_IS_ROUNDTRIP(value) (((value)&UCNV_EXT_FROM_U_ROUNDTRIP_FLAG)!=0) 1.472 +#define UCNV_EXT_FROM_U_MASK_ROUNDTRIP(value) ((value)&~UCNV_EXT_FROM_U_ROUNDTRIP_FLAG) 1.473 + 1.474 +/* get length; masks away all other bits */ 1.475 +#define UCNV_EXT_FROM_U_GET_LENGTH(value) (int32_t)(((value)>>UCNV_EXT_FROM_U_LENGTH_SHIFT)&UCNV_EXT_MAX_BYTES) 1.476 + 1.477 +/* get bytes or bytes index */ 1.478 +#define UCNV_EXT_FROM_U_GET_DATA(value) ((value)&UCNV_EXT_FROM_U_DATA_MASK) 1.479 + 1.480 +#endif 1.481 + 1.482 +#endif