Lines Matching refs:trie
42 get32(const UNewTrie2 *trie, UChar32 c, UBool fromLSCP) { in get32() argument
45 if(c>=trie->highStart && (!U_IS_LEAD(c) || fromLSCP)) { in get32()
46 return trie->data[trie->dataLength-UTRIE2_DATA_GRANULARITY]; in get32()
53 i2=trie->index1[c>>UTRIE2_SHIFT_1]+ in get32()
56 block=trie->index2[i2]; in get32()
57 return trie->data[block+(c&UTRIE2_DATA_MASK)]; in get32()
61 utrie2_get32(const UTrie2 *trie, UChar32 c) { in utrie2_get32() argument
62 if(trie->data16!=NULL) { in utrie2_get32()
63 return UTRIE2_GET16(trie, c); in utrie2_get32()
64 } else if(trie->data32!=NULL) { in utrie2_get32()
65 return UTRIE2_GET32(trie, c); in utrie2_get32()
67 return trie->errorValue; in utrie2_get32()
69 return get32(trie->newTrie, c, TRUE); in utrie2_get32()
74 utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c) { in utrie2_get32FromLeadSurrogateCodeUnit() argument
76 return trie->errorValue; in utrie2_get32FromLeadSurrogateCodeUnit()
78 if(trie->data16!=NULL) { in utrie2_get32FromLeadSurrogateCodeUnit()
79 return UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c); in utrie2_get32FromLeadSurrogateCodeUnit()
80 } else if(trie->data32!=NULL) { in utrie2_get32FromLeadSurrogateCodeUnit()
81 return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c); in utrie2_get32FromLeadSurrogateCodeUnit()
83 return get32(trie->newTrie, c, FALSE); in utrie2_get32FromLeadSurrogateCodeUnit()
88 u8Index(const UTrie2 *trie, UChar32 c, int32_t i) { in u8Index() argument
91 trie, in u8Index()
92 trie->data32==NULL ? trie->indexLength : 0, in u8Index()
98 utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c, in utrie2_internalU8NextIndex() argument
109 return u8Index(trie, c, i); in utrie2_internalU8NextIndex()
113 utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c, in utrie2_internalU8PrevIndex() argument
125 return u8Index(trie, c, i); in utrie2_internalU8PrevIndex()
137 UTrie2 *trie; in utrie2_openFromSerialized() local
195 trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); in utrie2_openFromSerialized()
196 if(trie==NULL) { in utrie2_openFromSerialized()
200 uprv_memcpy(trie, &tempTrie, sizeof(tempTrie)); in utrie2_openFromSerialized()
201 trie->memory=(uint32_t *)data; in utrie2_openFromSerialized()
202 trie->length=actualLength; in utrie2_openFromSerialized()
203 trie->isMemoryOwned=FALSE; in utrie2_openFromSerialized()
205 trie->name="fromSerialized"; in utrie2_openFromSerialized()
210 trie->index=p16; in utrie2_openFromSerialized()
211 p16+=trie->indexLength; in utrie2_openFromSerialized()
216 trie->data16=p16; in utrie2_openFromSerialized()
217 trie->data32=NULL; in utrie2_openFromSerialized()
218 trie->initialValue=trie->index[trie->dataNullOffset]; in utrie2_openFromSerialized()
219 trie->errorValue=trie->data16[UTRIE2_BAD_UTF8_DATA_OFFSET]; in utrie2_openFromSerialized()
222 trie->data16=NULL; in utrie2_openFromSerialized()
223 trie->data32=(const uint32_t *)p16; in utrie2_openFromSerialized()
224 trie->initialValue=trie->data32[trie->dataNullOffset]; in utrie2_openFromSerialized()
225 trie->errorValue=trie->data32[UTRIE2_BAD_UTF8_DATA_OFFSET]; in utrie2_openFromSerialized()
235 return trie; in utrie2_openFromSerialized()
242 UTrie2 *trie; in utrie2_openDummy() local
269 trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2)); in utrie2_openDummy()
270 if(trie==NULL) { in utrie2_openDummy()
274 uprv_memset(trie, 0, sizeof(UTrie2)); in utrie2_openDummy()
275 trie->memory=uprv_malloc(length); in utrie2_openDummy()
276 if(trie->memory==NULL) { in utrie2_openDummy()
277 uprv_free(trie); in utrie2_openDummy()
281 trie->length=length; in utrie2_openDummy()
282 trie->isMemoryOwned=TRUE; in utrie2_openDummy()
291 trie->indexLength=indexLength; in utrie2_openDummy()
292 trie->dataLength=dataLength; in utrie2_openDummy()
293 trie->index2NullOffset=UTRIE2_INDEX_2_OFFSET; in utrie2_openDummy()
294 trie->dataNullOffset=(uint16_t)dataMove; in utrie2_openDummy()
295 trie->initialValue=initialValue; in utrie2_openDummy()
296 trie->errorValue=errorValue; in utrie2_openDummy()
297 trie->highStart=0; in utrie2_openDummy()
298 trie->highValueIndex=dataMove+UTRIE2_DATA_START_OFFSET; in utrie2_openDummy()
300 trie->name="dummy"; in utrie2_openDummy()
304 header=(UTrie2Header *)trie->memory; in utrie2_openDummy()
317 trie->index=dest16; in utrie2_openDummy()
336 trie->data16=dest16; in utrie2_openDummy()
337 trie->data32=NULL; in utrie2_openDummy()
352 trie->data16=NULL; in utrie2_openDummy()
353 trie->data32=p; in utrie2_openDummy()
370 return trie; in utrie2_openDummy()
374 utrie2_close(UTrie2 *trie) { in utrie2_close() argument
375 if(trie!=NULL) { in utrie2_close()
376 if(trie->isMemoryOwned) { in utrie2_close()
377 uprv_free(trie->memory); in utrie2_close()
379 if(trie->newTrie!=NULL) { in utrie2_close()
380 uprv_free(trie->newTrie->data); in utrie2_close()
382 umutablecptrie_close(trie->newTrie->t3); in utrie2_close()
384 uprv_free(trie->newTrie); in utrie2_close()
386 uprv_free(trie); in utrie2_close()
391 utrie2_isFrozen(const UTrie2 *trie) { in utrie2_isFrozen() argument
392 return (UBool)(trie->newTrie==NULL); in utrie2_isFrozen()
396 utrie2_serialize(const UTrie2 *trie, in utrie2_serialize() argument
404 if( trie==NULL || trie->memory==NULL || trie->newTrie!=NULL || in utrie2_serialize()
411 if(capacity>=trie->length) { in utrie2_serialize()
412 uprv_memcpy(data, trie->memory, trie->length); in utrie2_serialize()
416 return trie->length; in utrie2_serialize()
443 enumEitherTrie(const UTrie2 *trie, in enumEitherTrie() argument
460 if(trie->newTrie==NULL) { in enumEitherTrie()
462 idx=trie->index; in enumEitherTrie()
464 data32=trie->data32; in enumEitherTrie()
466 index2NullOffset=trie->index2NullOffset; in enumEitherTrie()
467 nullBlock=trie->dataNullOffset; in enumEitherTrie()
471 data32=trie->newTrie->data; in enumEitherTrie()
474 index2NullOffset=trie->newTrie->index2NullOffset; in enumEitherTrie()
475 nullBlock=trie->newTrie->dataNullOffset; in enumEitherTrie()
478 highStart=trie->highStart; in enumEitherTrie()
481 initialValue=enumValue(context, trie->initialValue); in enumEitherTrie()
520 i2Block=trie->newTrie->index1[c>>UTRIE2_SHIFT_1]; in enumEitherTrie()
557 block=trie->newTrie->index2[i2Block+i2]; in enumEitherTrie()
600 data32[trie->highValueIndex] : in enumEitherTrie()
601 idx[trie->highValueIndex]; in enumEitherTrie()
603 highValue=trie->newTrie->data[trie->newTrie->dataLength-UTRIE2_DATA_GRANULARITY]; in enumEitherTrie()
621 utrie2_enum(const UTrie2 *trie, in utrie2_enum() argument
623 enumEitherTrie(trie, 0, 0x110000, enumValue, enumRange, context); in utrie2_enum()
627 utrie2_enumForLeadSurrogate(const UTrie2 *trie, UChar32 lead, in utrie2_enumForLeadSurrogate() argument
634 enumEitherTrie(trie, lead, lead+0x400, enumValue, enumRange, context); in utrie2_enumForLeadSurrogate()
645 return static_cast<uint16_t>(trie->errorValue); in previous16()
648 UTRIE2_U16_PREV16(trie, start, codePointStart, codePoint, result); in previous16()
656 return static_cast<uint16_t>(trie->errorValue); in next16()
659 UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result); in next16()