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