OLD | NEW |
(Empty) | |
| 1 /* |
| 2 ******************************************************************************* |
| 3 * |
| 4 * Copyright (C) 1999-2008, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. |
| 6 * |
| 7 ******************************************************************************* |
| 8 * file name: ucol_wgt.h |
| 9 * encoding: US-ASCII |
| 10 * tab size: 8 (not used) |
| 11 * indentation:4 |
| 12 * |
| 13 * created on: 2001mar08 |
| 14 * created by: Markus W. Scherer |
| 15 */ |
| 16 |
| 17 #ifndef UCOL_WGT_H |
| 18 #define UCOL_WGT_H |
| 19 |
| 20 #include "unicode/utypes.h" |
| 21 |
| 22 #if !UCONFIG_NO_COLLATION |
| 23 |
| 24 /* definitions for CE weights */ |
| 25 |
| 26 typedef struct WeightRange { |
| 27 uint32_t start, end; |
| 28 int32_t length, count; |
| 29 int32_t length2; |
| 30 uint32_t count2; |
| 31 } WeightRange; |
| 32 |
| 33 /** |
| 34 * Determine heuristically |
| 35 * what ranges to use for a given number of weights between (excluding) |
| 36 * two limits. |
| 37 * |
| 38 * @param lowerLimit A collation element weight; the ranges will be filled to co
ver |
| 39 * weights greater than this one. |
| 40 * @param upperLimit A collation element weight; the ranges will be filled to co
ver |
| 41 * weights less than this one. |
| 42 * @param n The number of collation element weights w necessary such th
at |
| 43 * lowerLimit<w<upperLimit in lexical order. |
| 44 * @param maxByte The highest valid byte value. |
| 45 * @param ranges An array that is filled in with one or more ranges to cover |
| 46 * n weights between the limits. |
| 47 * @return number of ranges, 0 if it is not possible to fit n elements between t
he limits |
| 48 */ |
| 49 U_CFUNC int32_t |
| 50 ucol_allocWeights(uint32_t lowerLimit, uint32_t upperLimit, |
| 51 uint32_t n, |
| 52 uint32_t maxByte, |
| 53 WeightRange ranges[7]); |
| 54 |
| 55 /** |
| 56 * Given a set of ranges calculated by ucol_allocWeights(), |
| 57 * iterate through the weights. |
| 58 * The ranges are modified to keep the current iteration state. |
| 59 * |
| 60 * @param ranges The array of ranges that ucol_allocWeights() filled in. |
| 61 * The ranges are modified. |
| 62 * @param pRangeCount The number of ranges. It will be decremented when necessar
y. |
| 63 * @return The next weight in the ranges, or 0xffffffff if there is none left. |
| 64 */ |
| 65 U_CFUNC uint32_t |
| 66 ucol_nextWeight(WeightRange ranges[], int32_t *pRangeCount); |
| 67 |
| 68 #endif /* #if !UCONFIG_NO_COLLATION */ |
| 69 |
| 70 #endif |
OLD | NEW |