• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/ICU-531.30/icuSources/common/

Lines Matching refs:trie

29  * This is a common implementation of a "folded" trie.
115 * Number of bytes for a dummy trie.
116 * A dummy trie is an empty runtime trie, used when a real data trie cannot
136 * @param data data value for a surrogate from the trie, including the folding offset
176 /** Internal trie getter from an offset (0 if c16 is a BMP/lead units) and a 16-bit unit */
177 #define _UTRIE_GET_RAW(trie, data, offset, c16) \
178 (trie)->data[ \
179 ((int32_t)((trie)->index[(offset)+((c16)>>UTRIE_SHIFT)])<<UTRIE_INDEX_SHIFT)+ \
183 /** Internal trie getter from a pair of surrogates */
184 #define _UTRIE_GET_FROM_PAIR(trie, data, c, c2, result, resultType) { \
188 (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \
189 __offset=(trie)->getFoldingOffset(result); \
193 (result)=_UTRIE_GET_RAW((trie), data, __offset, (c2)&0x3ff); \
195 (result)=(resultType)((trie)->initialValue); \
199 /** Internal trie getter from a BMP code point, treating a lead surrogate as a normal code point */
200 #define _UTRIE_GET_FROM_BMP(trie, data, c16) \
201 _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16);
204 * Internal trie getter from a code point.
206 * if((c32)<=0xd7ff) { (result)=_UTRIE_GET_RAW(trie, data, 0, c32); }
208 #define _UTRIE_GET(trie, data, c32, result, resultType) \
211 (result)=_UTRIE_GET_FROM_BMP(trie, data, c32); \
215 _UTRIE_GET_FROM_PAIR(trie, data, __lead16, c32, result, resultType); \
218 (result)=(resultType)((trie)->initialValue); \
222 #define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) { \
226 (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \
229 _UTRIE_GET_FROM_PAIR((trie), data, (c), (c2), (result), resultType); \
233 (result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
238 #define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) { \
242 (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \
248 _UTRIE_GET_FROM_PAIR((trie), data, (c), (c2), (result), resultType); \
252 (result)=_UTRIE_GET_RAW((trie), data, 0, (c)); \
257 (result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
267 * (trie->isLatin1Linear).
269 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
272 #define UTRIE_GET16_LATIN1(trie) ((trie)->index+(trie)->indexLength+UTRIE_DATA_BLOCK_LENGTH)
278 * (trie->isLatin1Linear).
280 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
283 #define UTRIE_GET32_LATIN1(trie) ((trie)->data32+UTRIE_DATA_BLOCK_LENGTH)
286 * Get a 16-bit trie value from a BMP code point (UChar, <=U+ffff).
289 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
291 * @return (uint16_t) trie lookup result
293 #define UTRIE_GET16_FROM_LEAD(trie, c16) _UTRIE_GET_RAW(trie, index, 0, c16)
296 * Get a 32-bit trie value from a BMP code point (UChar, <=U+ffff).
299 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
301 * @return (uint32_t) trie lookup result
303 #define UTRIE_GET32_FROM_LEAD(trie, c16) _UTRIE_GET_RAW(trie, data32, 0, c16)
306 * Get a 16-bit trie value from a BMP code point (UChar, <=U+ffff).
310 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
312 * @return (uint16_t) trie lookup result
314 #define UTRIE_GET16_FROM_BMP(trie, c16) _UTRIE_GET_FROM_BMP(trie, index, c16)
317 * Get a 32-bit trie value from a BMP code point (UChar, <=U+ffff).
321 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
323 * @return (uint32_t) trie lookup result
325 #define UTRIE_GET32_FROM_BMP(trie, c16) _UTRIE_GET_FROM_BMP(trie, data32, c16)
328 * Get a 16-bit trie value from a code point.
332 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
334 * @param result (uint16_t, out) uint16_t variable for the trie lookup result
336 #define UTRIE_GET16(trie, c32, result) _UTRIE_GET(trie, index, c32, result, uint16_t)
339 * Get a 32-bit trie value from a code point.
343 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
345 * @param result (uint32_t, out) uint32_t variable for the trie lookup result
347 #define UTRIE_GET32(trie, c32, result) _UTRIE_GET(trie, data32, c32, result, uint32_t)
351 * and get a 16-bit value from the trie.
353 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
358 * @param result (uint16_t, out) uint16_t variable for the trie lookup result
360 #define UTRIE_NEXT16(trie, src, limit, c, c2, result) _UTRIE_NEXT(trie, index, src, limit, c, c2, result, uint16_t)
364 * and get a 32-bit value from the trie.
366 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
371 * @param result (uint32_t, out) uint32_t variable for the trie lookup result
373 #define UTRIE_NEXT32(trie, src, limit, c, c2, result) _UTRIE_NEXT(trie, data32, src, limit, c, c2, result, uint32_t)
377 * and get a 16-bit value from the trie.
379 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
384 * @param result (uint16_t, out) uint16_t variable for the trie lookup result
386 #define UTRIE_PREVIOUS16(trie, start, src, c, c2, result) _UTRIE_PREVIOUS(trie, index, start, src, c, c2, result, uint16_t)
390 * and get a 32-bit value from the trie.
392 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
397 * @param result (uint32_t, out) uint32_t variable for the trie lookup result
399 #define UTRIE_PREVIOUS32(trie, start, src, c, c2, result) _UTRIE_PREVIOUS(trie, data32, start, src, c, c2, result, uint32_t)
402 * Get a 16-bit trie value from a pair of surrogates.
404 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
407 * @param result (uint16_t, out) uint16_t variable for the trie lookup result
409 #define UTRIE_GET16_FROM_PAIR(trie, c, c2, result) _UTRIE_GET_FROM_PAIR(trie, index, c, c2, result, uint16_t)
412 * Get a 32-bit trie value from a pair of surrogates.
414 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
417 * @param result (uint32_t, out) uint32_t variable for the trie lookup result
419 #define UTRIE_GET32_FROM_PAIR(trie, c, c2, result) _UTRIE_GET_FROM_PAIR(trie, data32, c, c2, result, uint32_t)
422 * Get a 16-bit trie value from a folding offset (from the value of a lead surrogate)
425 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
428 * @return (uint16_t) trie lookup result
430 #define UTRIE_GET16_FROM_OFFSET_TRAIL(trie, offset, c2) _UTRIE_GET_RAW(trie, index, offset, (c2)&0x3ff)
433 * Get a 32-bit trie value from a folding offset (from the value of a lead surrogate)
436 * @param trie (const UTrie *, in) a pointer to the runtime trie structure
439 * @return (uint32_t) trie lookup result
441 #define UTRIE_GET32_FROM_OFFSET_TRAIL(trie, offset, c2) _UTRIE_GET_RAW(trie, data32, offset, (c2)&0x3ff)
447 * trie value. This value will be passed on to the UTrieEnumRange function.
450 * @param value a value from the trie
458 * of code points with the same value as retrieved from the trie and
473 * Enumerate efficiently all values in a trie.
474 * For each entry in the trie, the value to be delivered is passed through
481 * @param trie a pointer to the runtime trie structure
482 * @param enumValue a pointer to a function that may transform the trie entry value,
483 * or NULL if the values from the trie are to be used directly
489 utrie_enum(const UTrie *trie,
493 * Unserialize a trie from 32-bit-aligned memory.
495 * Fills the UTrie runtime trie structure with the settings for the trie data.
497 * @param trie a pointer to the runtime trie structure
498 * @param data a pointer to 32-bit-aligned memory containing trie data
501 * @return the number of bytes at data taken up by the trie data
504 utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pErrorCode);
507 * "Unserialize" a dummy trie.
508 * A dummy trie is an empty runtime trie, used when a real data trie cannot
511 * The input memory is filled so that the trie always returns the initialValue,
515 * @param trie a pointer to the runtime trie structure
516 * @param data a pointer to 32-bit-aligned memory to be filled with the dummy trie data
527 utrie_unserializeDummy(UTrie *trie,
545 /* Building a trie ----------------------------------------------------------*/
548 * Build-time trie structure.
575 * Build-time trie callback function, used with utrie_serialize().
593 UNewTrieGetFoldedValue(UNewTrie *trie, UChar32 start, int32_t offset);
596 * Open a build-time trie structure.
600 * Although the trie is never fully expanded to a linear array, especially when
628 * Clone a build-time trie structure with all entries.
631 * @param other the build-time trie structure to clone
641 * Close a build-time trie structure, and release memory
644 * @param trie the build-time trie
647 utrie_close(UNewTrie *trie);
650 * Get the data array of a build-time trie.
654 * @param trie the build-time trie
660 utrie_getData(UNewTrie *trie, int32_t *pLength);
665 * @param trie the build-time trie
671 utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value);
674 * Get a value from a code point as stored in the build-time trie.
676 * @param trie the build-time trie
684 utrie_get32(UNewTrie *trie, UChar32 c, UBool *pInBlockZero);
691 * @param trie the build-time trie
699 utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, UBool overwrite);
702 * Compact the build-time trie after all values are set, and then
705 * After this, the trie can only be serizalized again and/or closed;
710 * @param trie the build-time trie
711 * @param data a pointer to 32-bit-aligned memory for the trie data
722 * - U_MEMORY_ALLOCATION_ERROR if the trie data array is too small
725 * @return the number of bytes written for the trie
728 utrie_serialize(UNewTrie *trie, void *data, int32_t capacity,