deps: update ICU to 68.1

Refs: https://github.com/unicode-org/icu/releases/tag/release-68-1

PR-URL: https://github.com/nodejs/node/pull/36187
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
This commit is contained in:
Michaël Zasso authored and Node.js GitHub Bot committed 2020-11-22 20:58:08 +00:00
1 parent 62a56264f6
commit f3821cd8d7
419 files changed
+12546 -5762

No files matched your search

+3 -3
View File
@@ -418,9 +418,9 @@ The externally maintained libraries used by Node.js are:
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
# Project: http://code.google.com/p/lao-dictionary/
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# Project: https://github.com/veer66/lao-dictionary
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
+3 -3
View File
@@ -284,9 +284,9 @@ property of their respective owners.
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
# Project: http://code.google.com/p/lao-dictionary/
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# Project: https://github.com/veer66/lao-dictionary
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
+2 -2
View File
@@ -1,8 +1,8 @@
ICU sources - auto generated by shrink-icu-src.py
This directory contains the ICU subset used by --with-intl=full-icu
It is a strict subset of ICU 67 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file
It is a strict subset of ICU 68 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt68l.dat.bz2 : compressed data file
To rebuild this directory, see ../../tools/icu/README.md
+11
View File
@@ -0,0 +1,11 @@
# © 2020 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html
---
Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 105
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
...
+1 -1
View File
@@ -101,7 +101,7 @@ private:
*/
UBool latin1Contains[0x100];
/* TRUE if contains(U+FFFD). */
/* true if contains(U+FFFD). */
UBool containsFFFD;
/*
+2 -2
View File
@@ -54,7 +54,7 @@ class LanguageBreakEngine : public UMemory {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @return TRUE if this engine handles the particular character and break
* @return true if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c) const = 0;
@@ -171,7 +171,7 @@ class UnhandledEngine : public LanguageBreakEngine {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @return TRUE if this engine handles the particular character and break
* @return true if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c) const;
+2 -2
View File
@@ -45,9 +45,9 @@ public:
static UBool appendUnchanged(const uint8_t *s, int32_t length,
ByteSink &sink, uint32_t options, Edits *edits,
UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return FALSE; }
if (U_FAILURE(errorCode)) { return false; }
if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); }
return TRUE;
return true;
}
static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit,
+26 -2
View File
@@ -20,6 +20,7 @@
#include "cmemory.h"
#include "cstring.h"
#include "uinvchar.h"
#include "ustr_imp.h"
U_NAMESPACE_BEGIN
@@ -46,6 +47,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const {
return p;
}
int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const {
if (U_FAILURE(errorCode)) { return len; }
if (capacity < 0 || (capacity > 0 && dest == nullptr)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return len;
}
const char *src = buffer.getAlias();
if (0 < len && len <= capacity && src != dest) {
uprv_memcpy(dest, src, len);
}
return u_terminateChars(dest, capacity, len, &errorCode);
}
CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
len=s.len;
@@ -197,7 +211,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) {
}
char c;
if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
append(U_FILE_SEP_CHAR, errorCode);
append(getDirSepChar(), errorCode);
}
append(s, errorCode);
return *this;
@@ -207,9 +221,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) {
char c;
if(U_SUCCESS(errorCode) && len>0 &&
(c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
append(U_FILE_SEP_CHAR, errorCode);
append(getDirSepChar(), errorCode);
}
return *this;
}
char CharString::getDirSepChar() const {
char dirSepChar = U_FILE_SEP_CHAR;
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
// We may need to return a different directory separator when building for Cygwin or MSYS2.
if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR))
dirSepChar = U_FILE_ALT_SEP_CHAR;
#endif
return dirSepChar;
}
U_NAMESPACE_END
+24 -2
View File
@@ -87,6 +87,22 @@ public:
* The caller must uprv_free() the result.
*/
char *cloneData(UErrorCode &errorCode) const;
/**
* Copies the contents of the string into dest.
* Checks if there is enough space in dest, extracts the entire string if possible,
* and NUL-terminates dest if possible.
*
* If the string fits into dest but cannot be NUL-terminated (length()==capacity),
* then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
* If the string itself does not fit into dest (length()>capacity),
* then the error code is set to U_BUFFER_OVERFLOW_ERROR.
*
* @param dest Destination string buffer.
* @param capacity Size of the dest buffer (number of chars).
* @param errorCode ICU error code.
* @return length()
*/
int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const;
bool operator==(StringPiece other) const {
return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
@@ -141,13 +157,13 @@ public:
/**
* Appends a filename/path part, e.g., a directory name.
* First appends a U_FILE_SEP_CHAR if necessary.
* First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary.
* Does nothing if s is empty.
*/
CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);
/**
* Appends a U_FILE_SEP_CHAR if this string is not empty
* Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty
* and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR.
*/
CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode);
@@ -160,6 +176,12 @@ private:
CharString(const CharString &other); // forbid copying of this class
CharString &operator=(const CharString &other); // forbid copying of this class
/**
* Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found.
* Otherwise returns U_FILE_SEP_CHAR.
*/
char getDirSepChar() const;
};
U_NAMESPACE_END
+55
View File
@@ -0,0 +1,55 @@
// © 2020 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
// charstrmap.h
// created: 2020sep01 Frank Yung-Fong Tang
#ifndef __CHARSTRMAP_H__
#define __CHARSTRMAP_H__
#include <utility>
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "uhash.h"
U_NAMESPACE_BEGIN
/**
* Map of const char * keys & values.
* Stores pointers as is: Does not own/copy/adopt/release strings.
*/
class CharStringMap final : public UMemory {
public:
/** Constructs an unusable non-map. */
CharStringMap() : map(nullptr) {}
CharStringMap(int32_t size, UErrorCode &errorCode) {
map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars,
size, &errorCode);
}
CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) {
other.map = nullptr;
}
CharStringMap(const CharStringMap &other) = delete;
~CharStringMap() {
uhash_close(map);
}
CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT {
map = other.map;
other.map = nullptr;
return *this;
}
CharStringMap &operator=(const CharStringMap &other) = delete;
const char *get(const char *key) const { return static_cast<const char *>(uhash_get(map, key)); }
void put(const char *key, const char *value, UErrorCode &errorCode) {
uhash_put(map, const_cast<char *>(key), const_cast<char *>(value), &errorCode);
}
private:
UHashtable *map;
};
U_NAMESPACE_END
#endif // __CHARSTRMAP_H__
+59 -30
View File
@@ -292,14 +292,21 @@ public:
/**
* Default constructor initializes with internal T[stackCapacity] buffer.
*/
MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(FALSE) {}
MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(false) {}
/**
* Automatically allocates the heap array if the argument is larger than the stack capacity.
* Intended for use when an approximate capacity is known at compile time but the true
* capacity is not known until runtime.
*/
MaybeStackArray(int32_t newCapacity) : MaybeStackArray() {
if (capacity < newCapacity) { resize(newCapacity); }
MaybeStackArray(int32_t newCapacity, UErrorCode status) : MaybeStackArray() {
if (U_FAILURE(status)) {
return;
}
if (capacity < newCapacity) {
if (resize(newCapacity) == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
}
}
/**
* Destructor deletes the array (if owned).
@@ -355,7 +362,7 @@ public:
releaseArray();
ptr=otherArray;
capacity=otherCapacity;
needToRelease=FALSE;
needToRelease=false;
}
}
/**
@@ -380,6 +387,20 @@ public:
* caller becomes responsible for deleting the array
*/
inline T *orphanOrClone(int32_t length, int32_t &resultCapacity);
protected:
// Resizes the array to the size of src, then copies the contents of src.
void copyFrom(const MaybeStackArray &src, UErrorCode &status) {
if (U_FAILURE(status)) {
return;
}
if (this->resize(src.capacity, 0) == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
uprv_memcpy(this->ptr, src.ptr, (size_t)capacity * sizeof(T));
}
private:
T *ptr;
int32_t capacity;
@@ -393,14 +414,14 @@ private:
void resetToStackArray() {
ptr=stackArray;
capacity=stackCapacity;
needToRelease=FALSE;
needToRelease=false;
}
/* No comparison operators with other MaybeStackArray's. */
bool operator==(const MaybeStackArray & /*other*/) {return FALSE;}
bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;}
bool operator==(const MaybeStackArray & /*other*/) = delete;
bool operator!=(const MaybeStackArray & /*other*/) = delete;
/* No ownership transfer: No copy constructor, no assignment operator. */
MaybeStackArray(const MaybeStackArray & /*other*/) {}
void operator=(const MaybeStackArray & /*other*/) {}
MaybeStackArray(const MaybeStackArray & /*other*/) = delete;
void operator=(const MaybeStackArray & /*other*/) = delete;
};
template<typename T, int32_t stackCapacity>
@@ -435,7 +456,7 @@ template<typename T, int32_t stackCapacity>
inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) {
if(newCapacity>0) {
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
::fprintf(::stderr,"MaybeStacArray (resize) alloc %d * %lu\n", newCapacity,sizeof(T));
::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T));
#endif
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
if(p!=NULL) {
@@ -451,7 +472,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
releaseArray();
ptr=p;
capacity=newCapacity;
needToRelease=TRUE;
needToRelease=true;
}
return p;
} else {
@@ -507,7 +528,7 @@ public:
/**
* Default constructor initializes with internal H+T[stackCapacity] buffer.
*/
MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(FALSE) {}
MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(false) {}
/**
* Destructor deletes the memory (if owned).
*/
@@ -556,7 +577,7 @@ public:
releaseMemory();
ptr=otherMemory;
capacity=otherCapacity;
needToRelease=FALSE;
needToRelease=false;
}
}
/**
@@ -595,8 +616,8 @@ private:
}
}
/* No comparison operators with other MaybeStackHeaderAndArray's. */
bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;}
bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;}
bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return false;}
bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return true;}
/* No ownership transfer: No copy constructor, no assignment operator. */
MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {}
void operator=(const MaybeStackHeaderAndArray & /*other*/) {}
@@ -625,7 +646,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
releaseMemory();
ptr=p;
capacity=newCapacity;
needToRelease=TRUE;
needToRelease=true;
}
return p;
} else {
@@ -657,7 +678,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
resultCapacity=length;
ptr=&stackHeader;
capacity=stackCapacity;
needToRelease=FALSE;
needToRelease=false;
return p;
}
@@ -728,6 +749,18 @@ public:
return fPool[fCount++] = new T(std::forward<Args>(args)...);
}
template <typename... Args>
T* createAndCheckErrorCode(UErrorCode &status, Args &&... args) {
if (U_FAILURE(status)) {
return nullptr;
}
T *pointer = this->create(args...);
if (U_SUCCESS(status) && pointer == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return pointer;
}
/**
* @return Number of elements that have been allocated.
*/
@@ -771,6 +804,11 @@ public:
return this->create(args...);
}
template <typename... Args>
T *emplaceBackAndCheckErrorCode(UErrorCode &status, Args &&... args) {
return this->createAndCheckErrorCode(status, args...);
}
int32_t length() const {
return this->fCount;
}
@@ -779,6 +817,10 @@ public:
return this->fPool.getAlias();
}
const T *const *getAlias() const {
return this->fPool.getAlias();
}
/**
* Array item access (read-only).
* No index bounds check.
@@ -798,19 +840,6 @@ public:
T* operator[](ptrdiff_t i) {
return this->fPool[i];
}
/**
* Append all the items from another MaybeStackVector to this one.
*/
void appendAll(const MaybeStackVector& other, UErrorCode& status) {
for (int32_t i = 0; i < other.fCount; i++) {
T* item = emplaceBack(*other[i]);
if (!item) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
}
};
+1 -1
View File
@@ -59,7 +59,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @return TRUE if this engine handles the particular character and break
* @return true if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c) const;
+6 -6
View File
@@ -145,7 +145,7 @@ static int32_t searchForLibrary(void *lib) {
return -1;
}
U_INTERNAL char * U_EXPORT2
U_CAPI char * U_EXPORT2
uplug_findLibrary(void *lib, UErrorCode *status) {
int32_t libEnt;
char *ret = NULL;
@@ -161,7 +161,7 @@ uplug_findLibrary(void *lib, UErrorCode *status) {
return ret;
}
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uplug_openLibrary(const char *libName, UErrorCode *status) {
int32_t libEntry = -1;
void *lib = NULL;
@@ -209,7 +209,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status) {
return lib;
}
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_closeLibrary(void *lib, UErrorCode *status) {
int32_t i;
@@ -507,7 +507,7 @@ uplug_getConfiguration(UPlugData *data) {
return data->config;
}
U_INTERNAL UPlugData* U_EXPORT2
U_CAPI UPlugData* U_EXPORT2
uplug_getPlugInternal(int32_t n) {
if(n <0 || n >= pluginCount) {
return NULL;
@@ -707,7 +707,7 @@ static void uplug_loadWaitingPlugs(UErrorCode *status) {
static char plugin_file[2048] = "";
#endif
U_INTERNAL const char* U_EXPORT2
U_CAPI const char* U_EXPORT2
uplug_getPluginFile() {
#if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO
return plugin_file;
@@ -782,7 +782,7 @@ uplug_init(UErrorCode *status) {
/* plugin_file is not used for processing - it is only used
so that uplug_getPluginFile() works (i.e. icuinfo)
*/
uprv_strncpy(plugin_file, pluginFile.data(), sizeof(plugin_file));
pluginFile.extract(plugin_file, sizeof(plugin_file), *status);
#if UPLUG_TRACE
DBG((stderr, "pluginfile= %s len %d/%d\n", plugin_file, (int)strlen(plugin_file), (int)sizeof(plugin_file)));
+6 -6
View File
@@ -36,7 +36,7 @@
* @return the library pointer, or NULL
* @internal internal use only
*/
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uplug_openLibrary(const char *libName, UErrorCode *status);
/**
@@ -45,7 +45,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status);
* @param status error code
* @internal internal use only
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_closeLibrary(void *lib, UErrorCode *status);
/**
@@ -55,7 +55,7 @@ uplug_closeLibrary(void *lib, UErrorCode *status);
* @return the library name, or NULL if not found.
* @internal internal use only
*/
U_INTERNAL char * U_EXPORT2
U_CAPI char * U_EXPORT2
uplug_findLibrary(void *lib, UErrorCode *status);
/** @} */
@@ -69,21 +69,21 @@ uplug_findLibrary(void *lib, UErrorCode *status);
* @param status error result
* @internal - Internal use only.
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_init(UErrorCode *status);
/**
* Get raw plug N
* @internal - Internal use only
*/
U_INTERNAL UPlugData* U_EXPORT2
U_CAPI UPlugData* U_EXPORT2
uplug_getPlugInternal(int32_t n);
/**
* Get the name of the plugin file.
* @internal - Internal use only.
*/
U_INTERNAL const char* U_EXPORT2
U_CAPI const char* U_EXPORT2
uplug_getPluginFile(void);
/** @} */
+68 -16
View File
@@ -1,12 +1,9 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// localematcher.cpp
// created: 2019may08 Markus W. Scherer
#ifndef __LOCMATCHER_H__
#define __LOCMATCHER_H__
#include "unicode/utypes.h"
#include "unicode/localebuilder.h"
#include "unicode/localematcher.h"
@@ -131,6 +128,7 @@ LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
thresholdDistance_(src.thresholdDistance_),
demotion_(src.demotion_),
defaultLocale_(src.defaultLocale_),
withDefault_(src.withDefault_),
favor_(src.favor_),
direction_(src.direction_) {
src.supportedLocales_ = nullptr;
@@ -140,6 +138,8 @@ LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
LocaleMatcher::Builder::~Builder() {
delete supportedLocales_;
delete defaultLocale_;
delete maxDistanceDesired_;
delete maxDistanceSupported_;
}
LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT {
@@ -150,6 +150,7 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder
thresholdDistance_ = src.thresholdDistance_;
demotion_ = src.demotion_;
defaultLocale_ = src.defaultLocale_;
withDefault_ = src.withDefault_,
favor_ = src.favor_;
direction_ = src.direction_;
@@ -229,6 +230,14 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale
return *this;
}
LocaleMatcher::Builder &LocaleMatcher::Builder::setNoDefaultLocale() {
if (U_FAILURE(errorCode_)) { return *this; }
delete defaultLocale_;
defaultLocale_ = nullptr;
withDefault_ = false;
return *this;
}
LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) {
if (U_FAILURE(errorCode_)) { return *this; }
Locale *clone = nullptr;
@@ -241,6 +250,7 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *d
}
delete defaultLocale_;
defaultLocale_ = clone;
withDefault_ = true;
return *this;
}
@@ -256,6 +266,24 @@ LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULoc
return *this;
}
LocaleMatcher::Builder &LocaleMatcher::Builder::setMaxDistance(const Locale &desired,
const Locale &supported) {
if (U_FAILURE(errorCode_)) { return *this; }
Locale *desiredClone = desired.clone();
Locale *supportedClone = supported.clone();
if (desiredClone == nullptr || supportedClone == nullptr) {
delete desiredClone; // in case only one could not be allocated
delete supportedClone;
errorCode_ = U_MEMORY_ALLOCATION_ERROR;
return *this;
}
delete maxDistanceDesired_;
delete maxDistanceSupported_;
maxDistanceDesired_ = desiredClone;
maxDistanceSupported_ = supportedClone;
return *this;
}
#if 0
/**
* <i>Internal only!</i>
@@ -340,9 +368,6 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
supportedLSRs(nullptr), supportedIndexes(nullptr), supportedLSRsLength(0),
ownedDefaultLocale(nullptr), defaultLocale(nullptr) {
if (U_FAILURE(errorCode)) { return; }
if (thresholdDistance < 0) {
thresholdDistance = localeDistance.getDefaultScriptDistance();
}
const Locale *def = builder.defaultLocale_;
LSR builderDefaultLSR;
const LSR *defLSR = nullptr;
@@ -408,22 +433,20 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
int32_t suppLength = 0;
// Determine insertion order.
// Add locales immediately that are equivalent to the default.
MaybeStackArray<int8_t, 100> order(supportedLocalesLength);
if (order.getAlias() == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return;
}
MaybeStackArray<int8_t, 100> order(supportedLocalesLength, errorCode);
if (U_FAILURE(errorCode)) { return; }
int32_t numParadigms = 0;
for (int32_t i = 0; i < supportedLocalesLength; ++i) {
const Locale &locale = *supportedLocales[i];
const LSR &lsr = lsrs[i];
if (defLSR == nullptr) {
if (defLSR == nullptr && builder.withDefault_) {
// Implicit default locale = first supported locale, if not turned off.
U_ASSERT(i == 0);
def = &locale;
defLSR = &lsr;
order[i] = 1;
suppLength = putIfAbsent(lsr, 0, suppLength, errorCode);
} else if (lsr.isEquivalentTo(*defLSR)) {
} else if (defLSR != nullptr && lsr.isEquivalentTo(*defLSR)) {
order[i] = 1;
suppLength = putIfAbsent(lsr, i, suppLength, errorCode);
} else if (localeDistance.isParadigmLSR(lsr)) {
@@ -458,6 +481,25 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) {
demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale();
}
if (thresholdDistance >= 0) {
// already copied
} else if (builder.maxDistanceDesired_ != nullptr) {
LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceSupported_, errorCode);
const LSR *pSuppLSR = &suppLSR;
int32_t indexAndDistance = localeDistance.getBestIndexAndDistance(
getMaximalLsrOrUnd(likelySubtags, *builder.maxDistanceDesired_, errorCode),
&pSuppLSR, 1,
LocaleDistance::shiftDistance(100), favorSubtag, direction);
if (U_SUCCESS(errorCode)) {
// +1 for an exclusive threshold from an inclusive max.
thresholdDistance = LocaleDistance::getDistanceFloor(indexAndDistance) + 1;
} else {
thresholdDistance = 0;
}
} else {
thresholdDistance = localeDistance.getDefaultScriptDistance();
}
}
LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT :
@@ -683,6 +725,18 @@ int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remai
return supportedIndexes[bestSupportedLsrIndex];
}
UBool LocaleMatcher::isMatch(const Locale &desired, const Locale &supported,
UErrorCode &errorCode) const {
LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode);
if (U_FAILURE(errorCode)) { return 0; }
const LSR *pSuppLSR = &suppLSR;
int32_t indexAndDistance = localeDistance.getBestIndexAndDistance(
getMaximalLsrOrUnd(likelySubtags, desired, errorCode),
&pSuppLSR, 1,
LocaleDistance::shiftDistance(thresholdDistance), favorSubtag, direction);
return indexAndDistance >= 0;
}
double LocaleMatcher::internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const {
// Returns the inverse of the distance: That is, 1-distance(desired, supported).
LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode);
@@ -790,5 +844,3 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
return acceptLanguage(*availableLocales, desiredLocales,
result, resultAvailable, outResult, *status);
}
#endif // __LOCMATCHER_H__
+1 -1
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// localeprioritylist.cpp
// created: 2019jul11 Markus W. Scherer
+1 -1
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// localeprioritylist.h
// created: 2019jul11 Markus W. Scherer
+30 -25
View File
@@ -26,6 +26,8 @@
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "unicode/ustring.h"
#include "bytesinkutil.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
#include "putilimp.h"
@@ -406,20 +408,26 @@ uloc_getDisplayScript(const char* locale,
UChar *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
UErrorCode err = U_ZERO_ERROR;
int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
UErrorCode err = U_ZERO_ERROR;
int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getScript, _kScriptsStandAlone, &err);
if ( err == U_USING_DEFAULT_WARNING ) {
if (destCapacity == 0 && err == U_BUFFER_OVERFLOW_ERROR) {
// For preflight, return the max of the value and the fallback.
int32_t fallback_res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getScript, _kScripts, pErrorCode);
return (fallback_res > res) ? fallback_res : res;
}
if ( err == U_USING_DEFAULT_WARNING ) {
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getScript, _kScripts, pErrorCode);
} else {
*pErrorCode = err;
return res;
}
uloc_getScript, _kScripts, pErrorCode);
} else {
*pErrorCode = err;
return res;
}
}
U_INTERNAL int32_t U_EXPORT2
static int32_t
uloc_getDisplayScriptInContext(const char* locale,
const char* displayLocale,
UChar *dest, int32_t destCapacity,
@@ -727,7 +735,7 @@ uloc_getDisplayName(const char *locale,
int32_t padLen;
patPos+=subLen;
padLen=(subi==0 ? sub1Pos : patLen)-patPos;
if(length+padLen < destCapacity) {
if(length+padLen <= destCapacity) {
p=dest+length;
for(int32_t i=0;i<padLen;++i) {
*p++=pattern[patPos++];
@@ -805,10 +813,6 @@ uloc_getDisplayKeywordValue( const char* locale,
UErrorCode* status){
char keywordValue[ULOC_FULLNAME_CAPACITY*4];
int32_t capacity = ULOC_FULLNAME_CAPACITY*4;
int32_t keywordValueLen =0;
/* argument checking */
if(status==NULL || U_FAILURE(*status)) {
return 0;
@@ -820,10 +824,11 @@ uloc_getDisplayKeywordValue( const char* locale,
}
/* get the keyword value */
keywordValue[0]=0;
keywordValueLen = uloc_getKeywordValue(locale, keyword, keywordValue, capacity, status);
if (*status == U_STRING_NOT_TERMINATED_WARNING)
*status = U_BUFFER_OVERFLOW_ERROR;
CharString keywordValue;
{
CharStringByteSink sink(&keywordValue);
ulocimp_getKeywordValue(locale, keyword, sink, status);
}
/*
* if the keyword is equal to currency .. then to get the display name
@@ -839,7 +844,7 @@ uloc_getDisplayKeywordValue( const char* locale,
icu::LocalUResourceBundlePointer currencies(
ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status));
icu::LocalUResourceBundlePointer currency(
ures_getByKeyWithFallback(currencies.getAlias(), keywordValue, NULL, status));
ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), NULL, status));
dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status);
@@ -863,12 +868,12 @@ uloc_getDisplayKeywordValue( const char* locale,
}
}else{
/* we have not found the display name for the value .. just copy over */
if(keywordValueLen <= destCapacity){
u_charsToUChars(keywordValue, dest, keywordValueLen);
return u_terminateUChars(dest, destCapacity, keywordValueLen, status);
if(keywordValue.length() <= destCapacity){
u_charsToUChars(keywordValue.data(), dest, keywordValue.length());
return u_terminateUChars(dest, destCapacity, keywordValue.length(), status);
}else{
*status = U_BUFFER_OVERFLOW_ERROR;
return keywordValueLen;
return keywordValue.length();
}
}
@@ -877,8 +882,8 @@ uloc_getDisplayKeywordValue( const char* locale,
return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale,
_kTypes, keyword,
keywordValue,
keywordValue,
keywordValue.data(),
keywordValue.data(),
dest, destCapacity,
status);
}
+1 -1
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// locdistance.cpp
// created: 2019may08 Markus W. Scherer
+5 -5
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// locdistance.h
// created: 2019may08 Markus W. Scherer
@@ -39,6 +39,10 @@ public:
return shiftedDistance / (1 << DISTANCE_SHIFT);
}
static int32_t getDistanceFloor(int32_t indexAndDistance) {
return (indexAndDistance & DISTANCE_MASK) >> DISTANCE_SHIFT;
}
static int32_t getIndex(int32_t indexAndDistance) {
// assert indexAndDistance >= 0;
return indexAndDistance >> INDEX_SHIFT;
@@ -79,10 +83,6 @@ private:
// tic constexpr int32_t MAX_INDEX = 0x1fffff; // avoids sign bit
static constexpr int32_t INDEX_NEG_1 = 0xfffffc00;
static int32_t getDistanceFloor(int32_t indexAndDistance) {
return (indexAndDistance & DISTANCE_MASK) >> DISTANCE_SHIFT;
}
LocaleDistance(const LocaleDistanceData &data, const XLikelySubtags &likely);
LocaleDistance(const LocaleDistance &other) = delete;
LocaleDistance &operator=(const LocaleDistance &other) = delete;
+1144 -271
View File
File diff suppressed because it is too large. Load diff
+82 -30
View File
@@ -464,8 +464,7 @@ parseTagString(
goto error;
}
subtagLength = ulocimp_getLanguage(position, lang, *langLength, &position);
u_terminateChars(lang, *langLength, subtagLength, err);
subtagLength = ulocimp_getLanguage(position, &position, *err).extract(lang, *langLength, *err);
/*
* Note that we explicit consider U_STRING_NOT_TERMINATED_WARNING
@@ -486,8 +485,7 @@ parseTagString(
++position;
}
subtagLength = ulocimp_getScript(position, script, *scriptLength, &position);
u_terminateChars(script, *scriptLength, subtagLength, err);
subtagLength = ulocimp_getScript(position, &position, *err).extract(script, *scriptLength, *err);
if(U_FAILURE(*err)) {
goto error;
@@ -511,8 +509,7 @@ parseTagString(
}
}
subtagLength = ulocimp_getCountry(position, region, *regionLength, &position);
u_terminateChars(region, *regionLength, subtagLength, err);
subtagLength = ulocimp_getCountry(position, &position, *err).extract(region, *regionLength, *err);
if(U_FAILURE(*err)) {
goto error;
@@ -826,7 +823,7 @@ error:
} \
} UPRV_BLOCK_MACRO_END
static void
static UBool
_uloc_addLikelySubtags(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err) {
@@ -897,15 +894,22 @@ _uloc_addLikelySubtags(const char* localeID,
sink.Append(localeID, localIDLength);
}
return;
return success;
error:
if (!U_FAILURE(*err)) {
*err = U_ILLEGAL_ARGUMENT_ERROR;
}
return FALSE;
}
// Add likely subtags to the sink
// return true if the value in the sink is produced by a match during the lookup
// return false if the value in the sink is the same as input because there are
// no match after the lookup.
static UBool _ulocimp_addLikelySubtags(const char*, icu::ByteSink&, UErrorCode*);
static void
_uloc_minimizeSubtags(const char* localeID,
icu::ByteSink& sink,
@@ -921,6 +925,7 @@ _uloc_minimizeSubtags(const char* localeID,
const char* trailing = "";
int32_t trailingLength = 0;
int32_t trailingIndex = 0;
UBool successGetMax = FALSE;
if(U_FAILURE(*err)) {
goto error;
@@ -961,7 +966,7 @@ _uloc_minimizeSubtags(const char* localeID,
{
icu::CharString base;
{
icu::CharStringByteSink sink(&base);
icu::CharStringByteSink baseSink(&base);
createTagString(
lang,
langLength,
@@ -971,7 +976,7 @@ _uloc_minimizeSubtags(const char* localeID,
regionLength,
NULL,
0,
sink,
baseSink,
err);
}
@@ -980,8 +985,8 @@ _uloc_minimizeSubtags(const char* localeID,
* from AddLikelySubtags.
**/
{
icu::CharStringByteSink sink(&maximizedTagBuffer);
ulocimp_addLikelySubtags(base.data(), sink, err);
icu::CharStringByteSink maxSink(&maximizedTagBuffer);
successGetMax = _ulocimp_addLikelySubtags(base.data(), maxSink, err);
}
}
@@ -989,13 +994,40 @@ _uloc_minimizeSubtags(const char* localeID,
goto error;
}
if (!successGetMax) {
/**
* If we got here, return the locale ID parameter unchanged.
**/
const int32_t localeIDLength = (int32_t)uprv_strlen(localeID);
sink.Append(localeID, localeIDLength);
return;
}
// In the following, the lang, script, region are referring to those in
// the maximizedTagBuffer, not the one in the localeID.
langLength = sizeof(lang);
scriptLength = sizeof(script);
regionLength = sizeof(region);
parseTagString(
maximizedTagBuffer.data(),
lang,
&langLength,
script,
&scriptLength,
region,
&regionLength,
err);
if(U_FAILURE(*err)) {
goto error;
}
/**
* Start first with just the language.
**/
{
icu::CharString tagBuffer;
{
icu::CharStringByteSink sink(&tagBuffer);
icu::CharStringByteSink tagSink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1005,14 +1037,15 @@ _uloc_minimizeSubtags(const char* localeID,
0,
NULL,
0,
sink,
tagSink,
err);
}
if(U_FAILURE(*err)) {
goto error;
}
else if (!tagBuffer.isEmpty() && uprv_strnicmp(
else if (!tagBuffer.isEmpty() &&
uprv_strnicmp(
maximizedTagBuffer.data(),
tagBuffer.data(),
tagBuffer.length()) == 0) {
@@ -1039,7 +1072,7 @@ _uloc_minimizeSubtags(const char* localeID,
icu::CharString tagBuffer;
{
icu::CharStringByteSink sink(&tagBuffer);
icu::CharStringByteSink tagSink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1049,14 +1082,15 @@ _uloc_minimizeSubtags(const char* localeID,
regionLength,
NULL,
0,
sink,
tagSink,
err);
}
if(U_FAILURE(*err)) {
goto error;
}
else if (uprv_strnicmp(
else if (!tagBuffer.isEmpty() &&
uprv_strnicmp(
maximizedTagBuffer.data(),
tagBuffer.data(),
tagBuffer.length()) == 0) {
@@ -1081,10 +1115,10 @@ _uloc_minimizeSubtags(const char* localeID,
* since trying with all three subtags would only yield the
* maximal version that we already have.
**/
if (scriptLength > 0 && regionLength > 0) {
if (scriptLength > 0) {
icu::CharString tagBuffer;
{
icu::CharStringByteSink sink(&tagBuffer);
icu::CharStringByteSink tagSink(&tagBuffer);
createLikelySubtagsString(
lang,
langLength,
@@ -1094,14 +1128,15 @@ _uloc_minimizeSubtags(const char* localeID,
0,
NULL,
0,
sink,
tagSink,
err);
}
if(U_FAILURE(*err)) {
goto error;
}
else if (uprv_strnicmp(
else if (!tagBuffer.isEmpty() &&
uprv_strnicmp(
maximizedTagBuffer.data(),
tagBuffer.data(),
tagBuffer.length()) == 0) {
@@ -1123,10 +1158,19 @@ _uloc_minimizeSubtags(const char* localeID,
{
/**
* If we got here, return the locale ID parameter.
* If we got here, return the max + trail.
**/
const int32_t localeIDLength = (int32_t)uprv_strlen(localeID);
sink.Append(localeID, localeIDLength);
createTagString(
lang,
langLength,
script,
scriptLength,
region,
regionLength,
trailing,
trailingLength,
sink,
err);
return;
}
@@ -1193,15 +1237,23 @@ uloc_addLikelySubtags(const char* localeID,
return reslen;
}
static UBool
_ulocimp_addLikelySubtags(const char* localeID,
icu::ByteSink& sink,
UErrorCode* status) {
char localeBuffer[ULOC_FULLNAME_CAPACITY];
if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) {
return _uloc_addLikelySubtags(localeBuffer, sink, status);
}
return FALSE;
}
U_CAPI void U_EXPORT2
ulocimp_addLikelySubtags(const char* localeID,
icu::ByteSink& sink,
UErrorCode* status) {
char localeBuffer[ULOC_FULLNAME_CAPACITY];
if (do_canonicalize(localeID, localeBuffer, sizeof localeBuffer, status)) {
_uloc_addLikelySubtags(localeBuffer, sink, status);
}
_ulocimp_addLikelySubtags(localeID, sink, status);
}
U_CAPI int32_t U_EXPORT2
+2 -66
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// loclikelysubtags.cpp
// created: 2019may08 Markus W. Scherer
@@ -20,6 +20,7 @@
#include "uhash.h"
#include "uinvchar.h"
#include "umutex.h"
#include "uniquecharstr.h"
#include "uresdata.h"
#include "uresimp.h"
@@ -31,71 +32,6 @@ constexpr char PSEUDO_ACCENTS_PREFIX = '\''; // -XA, -PSACCENT
constexpr char PSEUDO_BIDI_PREFIX = '+'; // -XB, -PSBIDI
constexpr char PSEUDO_CRACKED_PREFIX = ','; // -XC, -PSCRACK
/**
* Stores NUL-terminated strings with duplicate elimination.
* Checks for unique UTF-16 string pointers and converts to invariant characters.
*/
class UniqueCharStrings {
public:
UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) {
uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode);
if (U_FAILURE(errorCode)) { return; }
strings = new CharString();
if (strings == nullptr) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
}
}
~UniqueCharStrings() {
uhash_close(&map);
delete strings;
}
/** Returns/orphans the CharString that contains all strings. */
CharString *orphanCharStrings() {
CharString *result = strings;
strings = nullptr;
return result;
}
/** Adds a string and returns a unique number for it. */
int32_t add(const UnicodeString &s, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return 0; }
if (isFrozen) {
errorCode = U_NO_WRITE_PERMISSION;
return 0;
}
// The string points into the resource bundle.
const char16_t *p = s.getBuffer();
int32_t oldIndex = uhash_geti(&map, p);
if (oldIndex != 0) { // found duplicate
return oldIndex;
}
// Explicit NUL terminator for the previous string.
// The strings object is also terminated with one implicit NUL.
strings->append(0, errorCode);
int32_t newIndex = strings->length();
strings->appendInvariantChars(s, errorCode);
uhash_puti(&map, const_cast<char16_t *>(p), newIndex, &errorCode);
return newIndex;
}
void freeze() { isFrozen = true; }
/**
* Returns a string pointer for its unique number, if this object is frozen.
* Otherwise nullptr.
*/
const char *get(int32_t i) const {
U_ASSERT(isFrozen);
return isFrozen && i > 0 ? strings->data() + i : nullptr;
}
private:
UHashtable map;
CharString *strings;
bool isFrozen = false;
};
} // namespace
LocaleDistanceData::LocaleDistanceData(LocaleDistanceData &&data) :
+2 -38
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// loclikelysubtags.h
// created: 2019may08 Markus W. Scherer
@@ -13,49 +13,13 @@
#include "unicode/locid.h"
#include "unicode/uobject.h"
#include "unicode/ures.h"
#include "charstrmap.h"
#include "lsr.h"
#include "uhash.h"
U_NAMESPACE_BEGIN
struct XLikelySubtagsData;
/**
* Map of const char * keys & values.
* Stores pointers as is: Does not own/copy/adopt/release strings.
*/
class CharStringMap final : public UMemory {
public:
/** Constructs an unusable non-map. */
CharStringMap() : map(nullptr) {}
CharStringMap(int32_t size, UErrorCode &errorCode) {
map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars,
size, &errorCode);
}
CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) {
other.map = nullptr;
}
CharStringMap(const CharStringMap &other) = delete;
~CharStringMap() {
uhash_close(map);
}
CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT {
map = other.map;
other.map = nullptr;
return *this;
}
CharStringMap &operator=(const CharStringMap &other) = delete;
const char *get(const char *key) const { return static_cast<const char *>(uhash_get(map, key)); }
void put(const char *key, const char *value, UErrorCode &errorCode) {
uhash_put(map, const_cast<char *>(key), const_cast<char *>(value), &errorCode);
}
private:
UHashtable *map;
};
struct LocaleDistanceData {
LocaleDistanceData() = default;
LocaleDistanceData(LocaleDistanceData &&data);
+9 -3
View File
@@ -28,8 +28,11 @@
*/
#include "locmap.h"
#include "bytesinkutil.h"
#include "charstr.h"
#include "cstring.h"
#include "cmemory.h"
#include "ulocimp.h"
#include "unicode/uloc.h"
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
@@ -1167,15 +1170,18 @@ uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* status)
// conversion functionality when available.
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
int32_t len;
char collVal[ULOC_KEYWORDS_CAPACITY] = {};
char baseName[ULOC_FULLNAME_CAPACITY] = {};
const char * mylocaleID = localeID;
// Check any for keywords.
if (uprv_strchr(localeID, '@'))
{
len = uloc_getKeywordValue(localeID, "collation", collVal, UPRV_LENGTHOF(collVal) - 1, status);
if (U_SUCCESS(*status) && len > 0)
icu::CharString collVal;
{
icu::CharStringByteSink sink(&collVal);
ulocimp_getKeywordValue(localeID, "collation", sink, status);
}
if (U_SUCCESS(*status) && !collVal.isEmpty())
{
// If it contains the keyword collation, return 0 so that the LCID lookup table will be used.
return 0;
+1 -1
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// lsr.cpp
// created: 2019may08 Markus W. Scherer
+1 -1
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// lsr.h
// created: 2019may08 Markus W. Scherer
+1 -1
View File
@@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN
class U_COMMON_API MessageImpl {
public:
/**
* @return TRUE if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED
* @return true if getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED
*/
static UBool jdkAposMode(const MessagePattern &msgPattern) {
return msgPattern.getApostropheMode()==UMSGPAT_APOS_DOUBLE_REQUIRED;
+17 -17
View File
@@ -65,13 +65,13 @@ public:
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const {
return normalizeSecondAndAppend(first, second, TRUE, errorCode);
return normalizeSecondAndAppend(first, second, true, errorCode);
}
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
UErrorCode &errorCode) const {
return normalizeSecondAndAppend(first, second, FALSE, errorCode);
return normalizeSecondAndAppend(first, second, false, errorCode);
}
UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
@@ -112,14 +112,14 @@ public:
int32_t length;
const UChar *d=impl.getDecomposition(c, buffer, length);
if(d==NULL) {
return FALSE;
return false;
}
if(d==buffer) {
decomposition.setTo(buffer, length); // copy the string (Jamos from Hangul syllable c)
} else {
decomposition.setTo(FALSE, d, length); // read-only alias
decomposition.setTo(false, d, length); // read-only alias
}
return TRUE;
return true;
}
virtual UBool
getRawDecomposition(UChar32 c, UnicodeString &decomposition) const {
@@ -127,14 +127,14 @@ public:
int32_t length;
const UChar *d=impl.getRawDecomposition(c, buffer, length);
if(d==NULL) {
return FALSE;
return false;
}
if(d==buffer) {
decomposition.setTo(buffer, length); // copy the string (algorithmic decomposition)
} else {
decomposition.setTo(FALSE, d, length); // read-only alias
decomposition.setTo(false, d, length); // read-only alias
}
return TRUE;
return true;
}
virtual UChar32
composePair(UChar32 a, UChar32 b) const {
@@ -150,12 +150,12 @@ public:
virtual UBool
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
return FALSE;
return false;
}
const UChar *sArray=s.getBuffer();
if(sArray==NULL) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
return false;
}
const UChar *sLimit=sArray+s.length();
return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode);
@@ -227,7 +227,7 @@ private:
virtual void
normalize(const UChar *src, const UChar *limit,
ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
impl.compose(src, limit, onlyContiguous, TRUE, buffer, errorCode);
impl.compose(src, limit, onlyContiguous, true, buffer, errorCode);
}
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
@@ -256,24 +256,24 @@ private:
virtual UBool
isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return FALSE;
return false;
}
const UChar *sArray=s.getBuffer();
if(sArray==NULL) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
return false;
}
UnicodeString temp;
ReorderingBuffer buffer(impl, temp);
if(!buffer.init(5, errorCode)) { // small destCapacity for substring normalization
return FALSE;
return false;
}
return impl.compose(sArray, sArray+s.length(), onlyContiguous, FALSE, buffer, errorCode);
return impl.compose(sArray, sArray+s.length(), onlyContiguous, false, buffer, errorCode);
}
virtual UBool
isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE {
if(U_FAILURE(errorCode)) {
return FALSE;
return false;
}
const uint8_t *s = reinterpret_cast<const uint8_t *>(sp.data());
return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode);
@@ -343,7 +343,7 @@ private:
struct Norm2AllModes : public UMemory {
Norm2AllModes(Normalizer2Impl *i)
: impl(i), comp(*i, FALSE), decomp(*i), fcd(*i), fcc(*i, TRUE) {}
: impl(i), comp(*i, false), decomp(*i), fcd(*i), fcc(*i, true) {}
~Norm2AllModes();
static Norm2AllModes *createInstance(Normalizer2Impl *impl, UErrorCode &errorCode);
+5 -5
View File
@@ -171,7 +171,7 @@ public:
UErrorCode &errorCode);
UBool appendBMP(UChar c, uint8_t cc, UErrorCode &errorCode) {
if(remainingCapacity==0 && !resize(1, errorCode)) {
return FALSE;
return false;
}
if(lastCC<=cc || cc==0) {
*limit++=c;
@@ -183,7 +183,7 @@ public:
insert(c, cc);
}
--remainingCapacity;
return TRUE;
return true;
}
UBool appendZeroCC(UChar32 c, UErrorCode &errorCode);
UBool appendZeroCC(const UChar *s, const UChar *sLimit, UErrorCode &errorCode);
@@ -359,7 +359,7 @@ public:
return getFCD16FromNormData(c);
}
/** Returns TRUE if the single-or-lead code unit c might have non-zero FCD data. */
/** Returns true if the single-or-lead code unit c might have non-zero FCD data. */
UBool singleLeadMightHaveNonZeroFCD16(UChar32 lead) const {
// 0<=lead<=0xffff
uint8_t bits=smallFCD[lead>>8];
@@ -397,8 +397,8 @@ public:
MIN_YES_YES_WITH_CC=0xfe02,
JAMO_VT=0xfe00,
MIN_NORMAL_MAYBE_YES=0xfc00,
JAMO_L=2, // offset=1 hasCompBoundaryAfter=FALSE
INERT=1, // offset=0 hasCompBoundaryAfter=TRUE
JAMO_L=2, // offset=1 hasCompBoundaryAfter=false
INERT=1, // offset=0 hasCompBoundaryAfter=true
// norm16 bit 0 is comp-boundary-after.
HAS_COMP_BOUNDARY_AFTER=1,
+4 -4
View File
@@ -44,17 +44,17 @@ U_NAMESPACE_BEGIN
class U_COMMON_API PatternProps {
public:
/**
* @return TRUE if c is a Pattern_Syntax code point.
* @return true if c is a Pattern_Syntax code point.
*/
static UBool isSyntax(UChar32 c);
/**
* @return TRUE if c is a Pattern_Syntax or Pattern_White_Space code point.
* @return true if c is a Pattern_Syntax or Pattern_White_Space code point.
*/
static UBool isSyntaxOrWhiteSpace(UChar32 c);
/**
* @return TRUE if c is a Pattern_White_Space character.
* @return true if c is a Pattern_White_Space character.
*/
static UBool isWhiteSpace(UChar32 c);
@@ -78,7 +78,7 @@ public:
/**
* Tests whether the string contains a "pattern identifier", that is,
* whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters.
* @return TRUE if there are no Pattern_White_Space or Pattern_Syntax characters in s.
* @return true if there are no Pattern_White_Space or Pattern_Syntax characters in s.
*/
static UBool isIdentifier(const UChar *s, int32_t length);
+4 -4
View File
@@ -234,7 +234,7 @@ public:
}
/**
* Returns TRUE if this object equals rhs.
* Returns true if this object equals rhs.
*/
UBool equals(
const PluralMap<T> &rhs,
@@ -244,13 +244,13 @@ public:
continue;
}
if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) {
return FALSE;
return false;
}
if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) {
return FALSE;
return false;
}
}
return TRUE;
return true;
}
private:
+44 -43
View File
@@ -107,36 +107,26 @@ digitToBasic(int32_t digit, UBool uppercase) {
}
/**
* basicToDigit[] contains the numeric value of a basic code
* point (for use in representing integers) in the range 0 to
* BASE-1, or -1 if b is does not represent a value.
* @return the numeric value of a basic code point (for use in representing integers)
* in the range 0 to BASE-1, or a negative value if cp is invalid.
*/
static const int8_t
basicToDigit[256]={
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
static int32_t decodeDigit(int32_t cp) {
if(cp<=u'Z') {
if(cp<=u'9') {
if(cp<u'0') {
return -1;
} else {
return cp-u'0'+26; // 0..9 -> 26..35
}
} else {
return cp-u'A'; // A-Z -> 0..25
}
} else if(cp<=u'z') {
return cp-'a'; // a..z -> 0..25
} else {
return -1;
}
}
static inline char
asciiCaseMap(char b, UBool uppercase) {
@@ -178,15 +168,23 @@ adaptBias(int32_t delta, int32_t length, UBool firstTime) {
return count+(((BASE-TMIN+1)*delta)/(delta+SKEW));
}
#define MAX_CP_COUNT 200
namespace {
U_CFUNC int32_t
// ICU-13727: Limit input length for n^2 algorithm
// where well-formed strings are at most 59 characters long.
constexpr int32_t ENCODE_MAX_CODE_UNITS=1000;
constexpr int32_t DECODE_MAX_CHARS=2000;
} // namespace
// encode
U_CAPI int32_t
u_strToPunycode(const UChar *src, int32_t srcLength,
UChar *dest, int32_t destCapacity,
const UBool *caseFlags,
UErrorCode *pErrorCode) {
int32_t cpBuffer[MAX_CP_COUNT];
int32_t cpBuffer[ENCODE_MAX_CODE_UNITS];
int32_t n, delta, handledCPCount, basicLength, destLength, bias, j, m, q, k, t, srcCPCount;
UChar c, c2;
@@ -199,6 +197,10 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
if (srcLength>ENCODE_MAX_CODE_UNITS) {
*pErrorCode=U_INPUT_TOO_LONG_ERROR;
return 0;
}
/*
* Handle the basic code points and
@@ -211,9 +213,8 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
if((c=src[j])==0) {
break;
}
if(srcCPCount==MAX_CP_COUNT) {
/* too many input code points */
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
if(j>=ENCODE_MAX_CODE_UNITS) {
*pErrorCode=U_INPUT_TOO_LONG_ERROR;
return 0;
}
if(IS_BASIC(c)) {
@@ -243,11 +244,6 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
} else {
/* length-specified input */
for(j=0; j<srcLength; ++j) {
if(srcCPCount==MAX_CP_COUNT) {
/* too many input code points */
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
c=src[j];
if(IS_BASIC(c)) {
cpBuffer[srcCPCount++]=0;
@@ -312,7 +308,7 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
* Increase delta enough to advance the decoder's
* <n,i> state to <m,0>, but guard against overflow:
*/
if(m-n>(0x7fffffff-MAX_CP_COUNT-delta)/(handledCPCount+1)) {
if(m-n>(0x7fffffff-handledCPCount-delta)/(handledCPCount+1)) {
*pErrorCode=U_INTERNAL_PROGRAM_ERROR;
return 0;
}
@@ -373,7 +369,8 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
return u_terminateUChars(dest, destCapacity, destLength, pErrorCode);
}
U_CFUNC int32_t
// decode
U_CAPI int32_t
u_strFromPunycode(const UChar *src, int32_t srcLength,
UChar *dest, int32_t destCapacity,
UBool *caseFlags,
@@ -395,6 +392,10 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
if(srcLength==-1) {
srcLength=u_strlen(src);
}
if (srcLength>DECODE_MAX_CHARS) {
*pErrorCode=U_INPUT_TOO_LONG_ERROR;
return 0;
}
/*
* Handle the basic code points:
@@ -455,7 +456,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
return 0;
}
digit=basicToDigit[(uint8_t)src[in++]];
digit=decodeDigit(src[in++]);
if(digit<0) {
*pErrorCode=U_INVALID_CHAR_FOUND;
return 0;
+5 -5
View File
@@ -50,7 +50,7 @@ http://www.nicemice.net/amc/
* @param caseFlags Vector of boolean values, one per input UChar,
* indicating that the corresponding character is to be
* marked for the decoder optionally
* uppercasing (TRUE) or lowercasing (FALSE)
* uppercasing (true) or lowercasing (false)
* the character.
* ASCII characters are output directly in the case as marked.
* Flags corresponding to trail surrogates are ignored.
@@ -65,7 +65,7 @@ http://www.nicemice.net/amc/
*
* @see u_strFromPunycode
*/
U_CFUNC int32_t
U_CAPI int32_t
u_strToPunycode(const UChar *src, int32_t srcLength,
UChar *dest, int32_t destCapacity,
const UBool *caseFlags,
@@ -83,10 +83,10 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
* and of caseFlags in numbers of UBools.
* @param caseFlags Output array for case flags as
* defined by the Punycode string.
* The caller should uppercase (TRUE) or lowercase (FASLE)
* The caller should uppercase (true) or lowercase (FASLE)
* the corresponding character in dest.
* For supplementary characters, only the lead surrogate
* is marked, and FALSE is stored for the trail surrogate.
* is marked, and false is stored for the trail surrogate.
* This is redundant and not necessary for ASCII characters
* because they are already in the case indicated.
* Can be NULL if the case flags are not needed.
@@ -100,7 +100,7 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
*
* @see u_strToPunycode
*/
U_CFUNC int32_t
U_CAPI int32_t
u_strFromPunycode(const UChar *src, int32_t srcLength,
UChar *dest, int32_t destCapacity,
UBool *caseFlags,
+63 -11
View File
@@ -81,7 +81,7 @@
#include <float.h>
#ifndef U_COMMON_IMPLEMENTATION
#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see http://userguide.icu-project.org/howtouseicu
#error U_COMMON_IMPLEMENTATION not set - must be set for all ICU source files in common/ - see https://unicode-org.github.io/icu/userguide/howtouseicu
#endif
@@ -118,11 +118,15 @@
# ifndef _XPG4_2
# define _XPG4_2
# endif
# elif U_PLATFORM == U_PF_ANDROID
# include <sys/system_properties.h>
# include <dlfcn.h>
# endif
#elif U_PLATFORM == U_PF_QNX
# include <sys/neutrino.h>
#endif
/*
* Only include langinfo.h if we have a way to get the codeset. If we later
* depend on more feature, we can test on U_HAVE_NL_LANGINFO.
@@ -1043,9 +1047,53 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
}
#endif
#if U_PLATFORM == U_PF_ANDROID
typedef int(system_property_read_callback)(const prop_info* info,
void (*callback)(void* cookie,
const char* name,
const char* value,
uint32_t serial),
void* cookie);
typedef int(system_property_get)(const char*, char*);
static char gAndroidTimeZone[PROP_VALUE_MAX] = { '\0' };
static void u_property_read(void* cookie, const char* name, const char* value,
uint32_t serial) {
uprv_strcpy((char* )cookie, value);
}
#endif
U_CAPI void U_EXPORT2
uprv_tzname_clear_cache()
uprv_tzname_clear_cache(void)
{
#if U_PLATFORM == U_PF_ANDROID
/* Android's timezone is stored in system property. */
gAndroidTimeZone[0] = '\0';
void* libc = dlopen("libc.so", RTLD_NOLOAD);
if (libc) {
/* Android API 26+ has new API to get system property and old API
* (__system_property_get) is deprecated */
system_property_read_callback* property_read_callback =
(system_property_read_callback*)dlsym(
libc, "__system_property_read_callback");
if (property_read_callback) {
const prop_info* info =
__system_property_find("persist.sys.timezone");
if (info) {
property_read_callback(info, &u_property_read, gAndroidTimeZone);
}
} else {
system_property_get* property_get =
(system_property_get*)dlsym(libc, "__system_property_get");
if (property_get) {
property_get("persist.sys.timezone", gAndroidTimeZone);
}
}
dlclose(libc);
}
#endif
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
gTimeZoneBufferPtr = NULL;
#endif
@@ -1084,7 +1132,11 @@ uprv_tzname(int n)
/* This code can be temporarily disabled to test tzname resolution later on. */
#ifndef DEBUG_TZNAME
#if U_PLATFORM == U_PF_ANDROID
tzid = gAndroidTimeZone;
#else
tzid = getenv("TZ");
#endif
if (tzid != NULL && isValidOlsonID(tzid)
#if U_PLATFORM == U_PF_SOLARIS
/* When TZ equals localtime on Solaris, check the /etc/localtime file. */
@@ -2299,7 +2351,7 @@ u_getVersion(UVersionInfo versionArray) {
#include <dlfcn.h>
#endif /* HAVE_DLFCN_H */
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
void *ret = NULL;
if(U_FAILURE(*status)) return ret;
@@ -2313,13 +2365,13 @@ uprv_dl_open(const char *libName, UErrorCode *status) {
return ret;
}
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uprv_dl_close(void *lib, UErrorCode *status) {
if(U_FAILURE(*status)) return;
dlclose(lib);
}
U_INTERNAL UVoidFunction* U_EXPORT2
U_CAPI UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
union {
UVoidFunction *fp;
@@ -2342,7 +2394,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
/* Windows API implementation. */
// Note: UWP does not expose/allow these APIs, so the UWP version gets the null implementation. */
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
HMODULE lib = NULL;
@@ -2357,7 +2409,7 @@ uprv_dl_open(const char *libName, UErrorCode *status) {
return (void*)lib;
}
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uprv_dl_close(void *lib, UErrorCode *status) {
HMODULE handle = (HMODULE)lib;
if(U_FAILURE(*status)) return;
@@ -2367,7 +2419,7 @@ uprv_dl_close(void *lib, UErrorCode *status) {
return;
}
U_INTERNAL UVoidFunction* U_EXPORT2
U_CAPI UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
HMODULE handle = (HMODULE)lib;
UVoidFunction* addr = NULL;
@@ -2392,7 +2444,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
/* No dynamic loading, null (nonexistent) implementation. */
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
(void)libName;
if(U_FAILURE(*status)) return NULL;
@@ -2400,7 +2452,7 @@ uprv_dl_open(const char *libName, UErrorCode *status) {
return NULL;
}
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uprv_dl_close(void *lib, UErrorCode *status) {
(void)lib;
if(U_FAILURE(*status)) return;
@@ -2408,7 +2460,7 @@ uprv_dl_close(void *lib, UErrorCode *status) {
return;
}
U_INTERNAL UVoidFunction* U_EXPORT2
U_CAPI UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
(void)lib;
(void)sym;
+39 -39
View File
@@ -210,93 +210,93 @@ typedef size_t uintptr_t;
* Floating point utility to determine if a double is Not a Number (NaN).
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_isNaN(double d);
U_CAPI UBool U_EXPORT2 uprv_isNaN(double d);
/**
* Floating point utility to determine if a double has an infinite value.
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_isInfinite(double d);
U_CAPI UBool U_EXPORT2 uprv_isInfinite(double d);
/**
* Floating point utility to determine if a double has a positive infinite value.
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity(double d);
U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double d);
/**
* Floating point utility to determine if a double has a negative infinite value.
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity(double d);
U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double d);
/**
* Floating point utility that returns a Not a Number (NaN) value.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_getNaN(void);
U_CAPI double U_EXPORT2 uprv_getNaN(void);
/**
* Floating point utility that returns an infinite value.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_getInfinity(void);
U_CAPI double U_EXPORT2 uprv_getInfinity(void);
/**
* Floating point utility to truncate a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_trunc(double d);
U_CAPI double U_EXPORT2 uprv_trunc(double d);
/**
* Floating point utility to calculate the floor of a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_floor(double d);
U_CAPI double U_EXPORT2 uprv_floor(double d);
/**
* Floating point utility to calculate the ceiling of a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_ceil(double d);
U_CAPI double U_EXPORT2 uprv_ceil(double d);
/**
* Floating point utility to calculate the absolute value of a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_fabs(double d);
U_CAPI double U_EXPORT2 uprv_fabs(double d);
/**
* Floating point utility to calculate the fractional and integer parts of a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_modf(double d, double* pinteger);
U_CAPI double U_EXPORT2 uprv_modf(double d, double* pinteger);
/**
* Floating point utility to calculate the remainder of a double divided by another double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_fmod(double d, double y);
U_CAPI double U_EXPORT2 uprv_fmod(double d, double y);
/**
* Floating point utility to calculate d to the power of exponent (d^exponent).
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_pow(double d, double exponent);
U_CAPI double U_EXPORT2 uprv_pow(double d, double exponent);
/**
* Floating point utility to calculate 10 to the power of exponent (10^exponent).
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_pow10(int32_t exponent);
U_CAPI double U_EXPORT2 uprv_pow10(int32_t exponent);
/**
* Floating point utility to calculate the maximum value of two doubles.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_fmax(double d, double y);
U_CAPI double U_EXPORT2 uprv_fmax(double d, double y);
/**
* Floating point utility to calculate the minimum value of two doubles.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_fmin(double d, double y);
U_CAPI double U_EXPORT2 uprv_fmin(double d, double y);
/**
* Private utility to calculate the maximum value of two integers.
* @internal
*/
U_INTERNAL int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y);
U_CAPI int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y);
/**
* Private utility to calculate the minimum value of two integers.
* @internal
*/
U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
U_CAPI int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
#if U_IS_BIG_ENDIAN
# define uprv_isNegative(number) (*((signed char *)&(number))<0)
@@ -309,13 +309,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
* type of arbitrary bit length.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void);
U_CAPI double U_EXPORT2 uprv_maxMantissa(void);
/**
* Floating point utility to calculate the logarithm of a double.
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_log(double d);
U_CAPI double U_EXPORT2 uprv_log(double d);
/**
* Does common notion of rounding e.g. uprv_floor(x + 0.5);
@@ -323,7 +323,7 @@ U_INTERNAL double U_EXPORT2 uprv_log(double d);
* @return the rounded double
* @internal
*/
U_INTERNAL double U_EXPORT2 uprv_round(double x);
U_CAPI double U_EXPORT2 uprv_round(double x);
/**
* Adds the signed integers a and b, storing the result in res.
@@ -336,7 +336,7 @@ U_INTERNAL double U_EXPORT2 uprv_round(double x);
* @return true if overflow occurred; false if no overflow occurred.
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res);
U_CAPI UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* res);
/**
* Multiplies the signed integers a and b, storing the result in res.
@@ -349,7 +349,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_add32_overflow(int32_t a, int32_t b, int32_t* re
* @return true if overflow occurred; false if no overflow occurred.
* @internal
*/
U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res);
U_CAPI UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* res);
#if 0
/**
@@ -359,7 +359,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re
* @return the number of digits after the decimal point in a double number x.
* @internal
*/
/*U_INTERNAL int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/
/*U_CAPI int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/
#endif
#if !U_CHARSET_IS_UTF8
@@ -371,7 +371,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re
* @return the default codepage for this platform
* @internal
*/
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
U_CAPI const char* U_EXPORT2 uprv_getDefaultCodepage(void);
#endif
/**
@@ -383,7 +383,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
* @return the default locale ID string
* @internal
*/
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
U_CAPI const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
/**
* Time zone utilities
@@ -417,7 +417,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
* Date/Time application.
* @internal
*/
U_INTERNAL void U_EXPORT2 uprv_tzset(void);
U_CAPI void U_EXPORT2 uprv_tzset(void);
/**
* Difference in seconds between coordinated universal
@@ -425,7 +425,7 @@ U_INTERNAL void U_EXPORT2 uprv_tzset(void);
* @return the difference in seconds between coordinated universal time and local time.
* @internal
*/
U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
U_CAPI int32_t U_EXPORT2 uprv_timezone(void);
/**
* tzname(0) Three-letter time-zone name derived from TZ environment
@@ -435,13 +435,13 @@ U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
* tzname(1) is an empty string.
* @internal
*/
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
U_CAPI const char* U_EXPORT2 uprv_tzname(int n);
/**
* Reset the global tzname cache.
* @internal
*/
U_INTERNAL void uprv_tzname_clear_cache();
U_CAPI void uprv_tzname_clear_cache(void);
/**
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
@@ -449,7 +449,7 @@ U_INTERNAL void uprv_tzname_clear_cache();
* @return the UTC time measured in milliseconds
* @internal
*/
U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
U_CAPI UDate U_EXPORT2 uprv_getUTCtime(void);
/**
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
@@ -458,15 +458,15 @@ U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
* @return the UTC time measured in milliseconds
* @internal
*/
U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void);
U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime(void);
/**
* Determine whether a pathname is absolute or not, as defined by the platform.
* @param path Pathname to test
* @return TRUE if the path is absolute
* @return true if the path is absolute
* @internal (ICU 3.0)
*/
U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
U_CAPI UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
/**
* Use U_MAX_PTR instead of this function.
@@ -474,7 +474,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
* @return the largest possible pointer greater than the base
* @internal (ICU 3.8)
*/
U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
U_CAPI void * U_EXPORT2 uprv_maximumPtr(void *base);
/**
* Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
@@ -572,26 +572,26 @@ typedef void (UVoidFunction)(void);
* Load a library
* @internal (ICU 4.4)
*/
U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
U_CAPI void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
/**
* Close a library
* @internal (ICU 4.4)
*/
U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
U_CAPI void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
/**
* Extract a symbol from a library (function)
* @internal (ICU 4.8)
*/
U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status);
U_CAPI UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status);
/**
* Extract a symbol from a library (function)
* Not implemented, no clients.
* @internal
*/
/* U_INTERNAL void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
/* U_CAPI void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
#endif
+118 -89
View File
@@ -68,10 +68,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode
init(status);
fData = new RBBIDataWrapper(data, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == 0) {
if(fData == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
if (fData->fForwardTable->fLookAheadResultsSize > 0) {
fLookAheadMatches = static_cast<int32_t *>(
uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t)));
if (fLookAheadMatches == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
}
//
@@ -98,10 +106,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
}
fData = new RBBIDataWrapper(data, RBBIDataWrapper::kDontAdopt, status);
if (U_FAILURE(status)) {return;}
if(fData == 0) {
if(fData == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
if (fData->fForwardTable->fLookAheadResultsSize > 0) {
fLookAheadMatches = static_cast<int32_t *>(
uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t)));
if (fLookAheadMatches == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
}
@@ -117,10 +133,18 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &sta
init(status);
fData = new RBBIDataWrapper(udm, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == 0) {
if(fData == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
if (fData->fForwardTable->fLookAheadResultsSize > 0) {
fLookAheadMatches = static_cast<int32_t *>(
uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t)));
if (fLookAheadMatches == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
}
@@ -188,30 +212,34 @@ RuleBasedBreakIterator::~RuleBasedBreakIterator() {
// fCharIter was adopted from the outside.
delete fCharIter;
}
fCharIter = NULL;
fCharIter = nullptr;
utext_close(&fText);
if (fData != NULL) {
if (fData != nullptr) {
fData->removeReference();
fData = NULL;
fData = nullptr;
}
delete fBreakCache;
fBreakCache = NULL;
fBreakCache = nullptr;
delete fDictionaryCache;
fDictionaryCache = NULL;
fDictionaryCache = nullptr;
delete fLanguageBreakEngines;
fLanguageBreakEngines = NULL;
fLanguageBreakEngines = nullptr;
delete fUnhandledBreakEngine;
fUnhandledBreakEngine = NULL;
fUnhandledBreakEngine = nullptr;
uprv_free(fLookAheadMatches);
fLookAheadMatches = nullptr;
}
/**
* Assignment operator. Sets this iterator to have the same behavior,
* and iterate over the same text, as the one passed in.
* TODO: needs better handling of memory allocation errors.
*/
RuleBasedBreakIterator&
RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
@@ -252,6 +280,14 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
fData = that.fData->addReference();
}
uprv_free(fLookAheadMatches);
fLookAheadMatches = nullptr;
if (fData && fData->fForwardTable->fLookAheadResultsSize > 0) {
fLookAheadMatches = static_cast<int32_t *>(
uprv_malloc(fData->fForwardTable->fLookAheadResultsSize * sizeof(int32_t)));
}
fPosition = that.fPosition;
fRuleStatusIndex = that.fRuleStatusIndex;
fDone = that.fDone;
@@ -275,16 +311,17 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
//
//-----------------------------------------------------------------------------
void RuleBasedBreakIterator::init(UErrorCode &status) {
fCharIter = NULL;
fData = NULL;
fCharIter = nullptr;
fData = nullptr;
fPosition = 0;
fRuleStatusIndex = 0;
fDone = false;
fDictionaryCharCount = 0;
fLanguageBreakEngines = NULL;
fUnhandledBreakEngine = NULL;
fBreakCache = NULL;
fDictionaryCache = NULL;
fLanguageBreakEngines = nullptr;
fUnhandledBreakEngine = nullptr;
fBreakCache = nullptr;
fDictionaryCache = nullptr;
fLookAheadMatches = nullptr;
// Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER.
// fText = UTEXT_INITIALIZER;
@@ -700,50 +737,53 @@ enum RBBIRunMode {
};
// Map from look-ahead break states (corresponds to rules) to boundary positions.
// Allows multiple lookahead break rules to be in flight at the same time.
// Wrapper functions to select the appropriate handleNext() or handleSafePrevious()
// instantiation, based on whether an 8 or 16 bit table is required.
//
// This is a temporary approach for ICU 57. A better fix is to make the look-ahead numbers
// in the state table be sequential, then we can just index an array. And the
// table could also tell us in advance how big that array needs to be.
//
// Before ICU 57 there was just a single simple variable for a look-ahead match that
// was in progress. Two rules at once did not work.
// These Trie access functions will be inlined within the handleNext()/Previous() instantions.
static inline uint16_t TrieFunc8(const UCPTrie *trie, UChar32 c) {
return UCPTRIE_FAST_GET(trie, UCPTRIE_8, c);
}
static const int32_t kMaxLookaheads = 8;
struct LookAheadResults {
int32_t fUsedSlotLimit;
int32_t fPositions[8];
int16_t fKeys[8];
static inline uint16_t TrieFunc16(const UCPTrie *trie, UChar32 c) {
return UCPTRIE_FAST_GET(trie, UCPTRIE_16, c);
}
LookAheadResults() : fUsedSlotLimit(0), fPositions(), fKeys() {}
int32_t getPosition(int16_t key) {
for (int32_t i=0; i<fUsedSlotLimit; ++i) {
if (fKeys[i] == key) {
return fPositions[i];
}
int32_t RuleBasedBreakIterator::handleNext() {
const RBBIStateTable *statetable = fData->fForwardTable;
bool use8BitsTrie = ucptrie_getValueWidth(fData->fTrie) == UCPTRIE_VALUE_BITS_8;
if (statetable->fFlags & RBBI_8BITS_ROWS) {
if (use8BitsTrie) {
return handleNext<RBBIStateTableRow8, TrieFunc8>();
} else {
return handleNext<RBBIStateTableRow8, TrieFunc16>();
}
} else {
if (use8BitsTrie) {
return handleNext<RBBIStateTableRow16, TrieFunc8>();
} else {
return handleNext<RBBIStateTableRow16, TrieFunc16>();
}
UPRV_UNREACHABLE;
}
}
void setPosition(int16_t key, int32_t position) {
int32_t i;
for (i=0; i<fUsedSlotLimit; ++i) {
if (fKeys[i] == key) {
fPositions[i] = position;
return;
}
int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
const RBBIStateTable *statetable = fData->fReverseTable;
bool use8BitsTrie = ucptrie_getValueWidth(fData->fTrie) == UCPTRIE_VALUE_BITS_8;
if (statetable->fFlags & RBBI_8BITS_ROWS) {
if (use8BitsTrie) {
return handleSafePrevious<RBBIStateTableRow8, TrieFunc8>(fromPosition);
} else {
return handleSafePrevious<RBBIStateTableRow8, TrieFunc16>(fromPosition);
}
if (i >= kMaxLookaheads) {
UPRV_UNREACHABLE;
} else {
if (use8BitsTrie) {
return handleSafePrevious<RBBIStateTableRow16, TrieFunc8>(fromPosition);
} else {
return handleSafePrevious<RBBIStateTableRow16, TrieFunc16>(fromPosition);
}
fKeys[i] = key;
fPositions[i] = position;
U_ASSERT(fUsedSlotLimit == i);
fUsedSlotLimit = i + 1;
}
};
}
//-----------------------------------------------------------------------------------
@@ -752,19 +792,20 @@ struct LookAheadResults {
// Run the state machine to find a boundary
//
//-----------------------------------------------------------------------------------
template <typename RowType, RuleBasedBreakIterator::PTrieFunc trieFunc>
int32_t RuleBasedBreakIterator::handleNext() {
int32_t state;
uint16_t category = 0;
RBBIRunMode mode;
RBBIStateTableRow *row;
RowType *row;
UChar32 c;
LookAheadResults lookAheadMatches;
int32_t result = 0;
int32_t initialPosition = 0;
const RBBIStateTable *statetable = fData->fForwardTable;
const char *tableData = statetable->fTableData;
uint32_t tableRowLen = statetable->fRowLen;
uint32_t dictStart = statetable->fDictCategoriesStart;
#ifdef RBBI_DEBUG
if (gTrace) {
RBBIDebugPuts("Handle Next pos char state category");
@@ -789,7 +830,7 @@ int32_t RuleBasedBreakIterator::handleNext() {
// Set the initial state for the state machine
state = START_STATE;
row = (RBBIStateTableRow *)
row = (RowType *)
//(statetable->fTableData + (statetable->fRowLen * state));
(tableData + tableRowLen * state);
@@ -825,21 +866,8 @@ int32_t RuleBasedBreakIterator::handleNext() {
if (mode == RBBI_RUN) {
// look up the current character's character category, which tells us
// which column in the state table to look at.
// Note: the 16 in UTRIE_GET16 refers to the size of the data being returned,
// not the size of the character going in, which is a UChar32.
//
category = UTRIE2_GET16(fData->fTrie, c);
// Check the dictionary bit in the character's category.
// Counter is only used by dictionary based iteration.
// Chars that need to be handled by a dictionary have a flag bit set
// in their category values.
//
if ((category & 0x4000) != 0) {
fDictionaryCharCount++;
// And off the dictionary flag bit.
category &= ~0x4000;
}
category = trieFunc(fData->fTrie, c);
fDictionaryCharCount += (category >= dictStart);
}
#ifdef RBBI_DEBUG
@@ -860,25 +888,24 @@ int32_t RuleBasedBreakIterator::handleNext() {
// fNextState is a variable-length array.
U_ASSERT(category<fData->fHeader->fCatCount);
state = row->fNextState[category]; /*Not accessing beyond memory*/
row = (RBBIStateTableRow *)
row = (RowType *)
// (statetable->fTableData + (statetable->fRowLen * state));
(tableData + tableRowLen * state);
if (row->fAccepting == -1) {
uint16_t accepting = row->fAccepting;
if (accepting == ACCEPTING_UNCONDITIONAL) {
// Match found, common case.
if (mode != RBBI_START) {
result = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
}
fRuleStatusIndex = row->fTagIdx; // Remember the break status (tag) values.
}
int16_t completedRule = row->fAccepting;
if (completedRule > 0) {
fRuleStatusIndex = row->fTagsIdx; // Remember the break status (tag) values.
} else if (accepting > ACCEPTING_UNCONDITIONAL) {
// Lookahead match is completed.
int32_t lookaheadResult = lookAheadMatches.getPosition(completedRule);
U_ASSERT(accepting < fData->fForwardTable->fLookAheadResultsSize);
int32_t lookaheadResult = fLookAheadMatches[accepting];
if (lookaheadResult >= 0) {
fRuleStatusIndex = row->fTagIdx;
fRuleStatusIndex = row->fTagsIdx;
fPosition = lookaheadResult;
return lookaheadResult;
}
@@ -890,10 +917,12 @@ int32_t RuleBasedBreakIterator::handleNext() {
// This would enable hard-break rules with no following context.
// But there are line break test failures when trying this. Investigate.
// Issue ICU-20837
int16_t rule = row->fLookAhead;
if (rule != 0) {
uint16_t rule = row->fLookAhead;
U_ASSERT(rule == 0 || rule > ACCEPTING_UNCONDITIONAL);
U_ASSERT(rule == 0 || rule < fData->fForwardTable->fLookAheadResultsSize);
if (rule > ACCEPTING_UNCONDITIONAL) {
int32_t pos = (int32_t)UTEXT_GETNATIVEINDEX(&fText);
lookAheadMatches.setPosition(rule, pos);
fLookAheadMatches[rule] = pos;
}
if (state == STOP_STATE) {
@@ -948,10 +977,12 @@ int32_t RuleBasedBreakIterator::handleNext() {
// because the safe table does not require as many options.
//
//-----------------------------------------------------------------------------------
template <typename RowType, RuleBasedBreakIterator::PTrieFunc trieFunc>
int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
int32_t state;
uint16_t category = 0;
RBBIStateTableRow *row;
RowType *row;
UChar32 c;
int32_t result = 0;
@@ -971,7 +1002,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
// Set the initial state for the state machine
c = UTEXT_PREVIOUS32(&fText);
state = START_STATE;
row = (RBBIStateTableRow *)
row = (RowType *)
(stateTable->fTableData + (stateTable->fRowLen * state));
// loop until we reach the start of the text or transition to state 0
@@ -980,12 +1011,9 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
// look up the current character's character category, which tells us
// which column in the state table to look at.
// Note: the 16 in UTRIE_GET16 refers to the size of the data being returned,
// not the size of the character going in, which is a UChar32.
//
// And off the dictionary flag bit. For reverse iteration it is not used.
category = UTRIE2_GET16(fData->fTrie, c);
category &= ~0x4000;
// Off the dictionary flag bit. For reverse iteration it is not used.
category = trieFunc(fData->fTrie, c);
#ifdef RBBI_DEBUG
if (gTrace) {
@@ -1004,7 +1032,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
// fNextState is a variable-length array.
U_ASSERT(category<fData->fHeader->fCatCount);
state = row->fNextState[category]; /*Not accessing beyond memory*/
row = (RBBIStateTableRow *)
row = (RowType *)
(stateTable->fTableData + (stateTable->fRowLen * state));
if (state == STOP_STATE) {
@@ -1024,6 +1052,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
return result;
}
//-------------------------------------------------------------------------------
//
// getRuleStatus() Return the break rule tag associated with the current
+6 -4
View File
@@ -142,13 +142,15 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo
utext_setNativeIndex(text, rangeStart);
UChar32 c = utext_current32(text);
category = UTRIE2_GET16(fBI->fData->fTrie, c);
category = ucptrie_get(fBI->fData->fTrie, c);
uint32_t dictStart = fBI->fData->fForwardTable->fDictCategoriesStart;
while(U_SUCCESS(status)) {
while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd && (category & 0x4000) == 0) {
while((current = (int32_t)UTEXT_GETNATIVEINDEX(text)) < rangeEnd
&& (category < dictStart)) {
utext_next32(text); // TODO: cleaner loop structure.
c = utext_current32(text);
category = UTRIE2_GET16(fBI->fData->fTrie, c);
category = ucptrie_get(fBI->fData->fTrie, c);
}
if (current >= rangeEnd) {
break;
@@ -166,7 +168,7 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo
// Reload the loop variables for the next go-round
c = utext_current32(text);
category = UTRIE2_GET16(fBI->fData->fTrie, c);
category = ucptrie_get(fBI->fData->fTrie, c);
}
// If we found breaks, ensure that the first and last entries are
+3 -3
View File
@@ -126,13 +126,13 @@ class RuleBasedBreakIterator::BreakCache: public UMemory {
* Additional boundaries, either preceding or following, may be added
* to the cache as a side effect.
*
* Return FALSE if the operation failed.
* Return false if the operation failed.
*/
UBool populateNear(int32_t position, UErrorCode &status);
/**
* Add boundary(s) to the cache following the current last boundary.
* Return FALSE if at the end of the text, and no more boundaries can be added.
* Return false if at the end of the text, and no more boundaries can be added.
* Leave iteration position at the first newly added boundary, or unchanged if no boundary was added.
*/
UBool populateFollowing();
@@ -170,7 +170,7 @@ class RuleBasedBreakIterator::BreakCache: public UMemory {
* Fails if the requested position is outside of the range of boundaries currently held by the cache.
* The startPosition must be on a code point boundary.
*
* Return TRUE if successful, FALSE if the specified position is after
* Return true if successful, false if the specified position is after
* the last cached boundary or before the first.
*/
UBool seek(int32_t startPosition);
+1 -1
View File
@@ -1,6 +1,6 @@
#**************************************************************************
# Copyright (C) 2016 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html#License
# License & terms of use: http://www.unicode.org/copyright.html
#**************************************************************************
#**************************************************************************
# Copyright (C) 2002-2016 International Business Machines Corporation
+75 -24
View File
@@ -11,10 +11,10 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/ucptrie.h"
#include "unicode/utypes.h"
#include "rbbidata.h"
#include "rbbirb.h"
#include "utrie2.h"
#include "udatamem.h"
#include "cmemory.h"
#include "cstring.h"
@@ -110,17 +110,24 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
fReverseTable = (RBBIStateTable *)((char *)data + fHeader->fRTable);
}
fTrie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
(uint8_t *)data + fHeader->fTrie,
fHeader->fTrieLen,
NULL, // *actual length
&status);
fTrie = ucptrie_openFromBinary(UCPTRIE_TYPE_FAST,
UCPTRIE_VALUE_BITS_ANY,
(uint8_t *)data + fHeader->fTrie,
fHeader->fTrieLen,
nullptr, // *actual length
&status);
if (U_FAILURE(status)) {
return;
}
fRuleSource = (UChar *)((char *)data + fHeader->fRuleSource);
fRuleString.setTo(TRUE, fRuleSource, -1);
UCPTrieValueWidth width = ucptrie_getValueWidth(fTrie);
if (!(width == UCPTRIE_VALUE_BITS_8 || width == UCPTRIE_VALUE_BITS_16)) {
status = U_INVALID_FORMAT_ERROR;
return;
}
fRuleSource = ((char *)data + fHeader->fRuleSource);
fRuleString = UnicodeString::fromUTF8(StringPiece(fRuleSource, fHeader->fRuleSourceLen));
U_ASSERT(data->fRuleSourceLen > 0);
fRuleStatusTable = (int32_t *)((char *)data + fHeader->fStatusTable);
@@ -142,8 +149,8 @@ void RBBIDataWrapper::init(const RBBIDataHeader *data, UErrorCode &status) {
//-----------------------------------------------------------------------------
RBBIDataWrapper::~RBBIDataWrapper() {
U_ASSERT(fRefCount == 0);
utrie2_close(fTrie);
fTrie = NULL;
ucptrie_close(fTrie);
fTrie = nullptr;
if (fUDataMem) {
udata_close(fUDataMem);
} else if (!fDontFreeData) {
@@ -223,9 +230,16 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
uint32_t c;
uint32_t s;
RBBIDebugPrintf(" %s\n", heading);
RBBIDebugPrintf("%s\n", heading);
RBBIDebugPrintf("State | Acc LA TagIx");
RBBIDebugPrintf(" fDictCategoriesStart: %d\n", table->fDictCategoriesStart);
RBBIDebugPrintf(" fLookAheadResultsSize: %d\n", table->fLookAheadResultsSize);
RBBIDebugPrintf(" Flags: %4x RBBI_LOOKAHEAD_HARD_BREAK=%s RBBI_BOF_REQUIRED=%s RBBI_8BITS_ROWS=%s\n",
table->fFlags,
table->fFlags & RBBI_LOOKAHEAD_HARD_BREAK ? "T" : "F",
table->fFlags & RBBI_BOF_REQUIRED ? "T" : "F",
table->fFlags & RBBI_8BITS_ROWS ? "T" : "F");
RBBIDebugPrintf("\nState | Acc LA TagIx");
for (c=0; c<fHeader->fCatCount; c++) {RBBIDebugPrintf("%3d ", c);}
RBBIDebugPrintf("\n------|---------------"); for (c=0;c<fHeader->fCatCount; c++) {
RBBIDebugPrintf("----");
@@ -236,12 +250,20 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
RBBIDebugPrintf(" N U L L T A B L E\n\n");
return;
}
UBool use8Bits = table->fFlags & RBBI_8BITS_ROWS;
for (s=0; s<table->fNumStates; s++) {
RBBIStateTableRow *row = (RBBIStateTableRow *)
(table->fTableData + (table->fRowLen * s));
RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->fAccepting, row->fLookAhead, row->fTagIdx);
for (c=0; c<fHeader->fCatCount; c++) {
RBBIDebugPrintf("%3d ", row->fNextState[c]);
if (use8Bits) {
RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->r8.fAccepting, row->r8.fLookAhead, row->r8.fTagsIdx);
for (c=0; c<fHeader->fCatCount; c++) {
RBBIDebugPrintf("%3d ", row->r8.fNextState[c]);
}
} else {
RBBIDebugPrintf("%4d | %3d %3d %3d ", s, row->r16.fAccepting, row->r16.fLookAhead, row->r16.fTagsIdx);
for (c=0; c<fHeader->fCatCount; c++) {
RBBIDebugPrintf("%3d ", row->r16.fNextState[c]);
}
}
RBBIDebugPrintf("\n");
}
@@ -382,10 +404,23 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
tableLength = ds->readUInt32(rbbiDH->fFTableLen);
if (tableLength > 0) {
RBBIStateTable *rbbiST = (RBBIStateTable *)(inBytes+tableStartOffset);
UBool use8Bits = ds->readUInt32(rbbiST->fFlags) & RBBI_8BITS_ROWS;
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
// Swap the state table if the table is in 16 bits.
if (use8Bits) {
if (outBytes != inBytes) {
uprv_memmove(outBytes+tableStartOffset+topSize,
inBytes+tableStartOffset+topSize,
tableLength-topSize);
}
} else {
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
}
// Reverse state table. Same layout as forward table, above.
@@ -393,19 +428,35 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
tableLength = ds->readUInt32(rbbiDH->fRTableLen);
if (tableLength > 0) {
RBBIStateTable *rbbiST = (RBBIStateTable *)(inBytes+tableStartOffset);
UBool use8Bits = ds->readUInt32(rbbiST->fFlags) & RBBI_8BITS_ROWS;
ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
// Swap the state table if the table is in 16 bits.
if (use8Bits) {
if (outBytes != inBytes) {
uprv_memmove(outBytes+tableStartOffset+topSize,
inBytes+tableStartOffset+topSize,
tableLength-topSize);
}
} else {
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
}
// Trie table for character categories
utrie2_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen),
outBytes+ds->readUInt32(rbbiDH->fTrie), status);
ucptrie_swap(ds, inBytes+ds->readUInt32(rbbiDH->fTrie), ds->readUInt32(rbbiDH->fTrieLen),
outBytes+ds->readUInt32(rbbiDH->fTrie), status);
// Source Rules Text. It's UChar data
ds->swapArray16(ds, inBytes+ds->readUInt32(rbbiDH->fRuleSource), ds->readUInt32(rbbiDH->fRuleSourceLen),
outBytes+ds->readUInt32(rbbiDH->fRuleSource), status);
// Source Rules Text. It's UTF8 data
if (outBytes != inBytes) {
uprv_memmove(outBytes+ds->readUInt32(rbbiDH->fRuleSource),
inBytes+ds->readUInt32(rbbiDH->fRuleSource),
ds->readUInt32(rbbiDH->fRuleSourceLen));
}
// Table of rule status values. It's all int_32 values
ds->swapArray32(ds, inBytes+ds->readUInt32(rbbiDH->fStatusTable), ds->readUInt32(rbbiDH->fStatusTableLen),
+56 -43
View File
@@ -49,16 +49,17 @@ ubrk_swap(const UDataSwapper *ds,
#ifdef __cplusplus
#include "unicode/ucptrie.h"
#include "unicode/uobject.h"
#include "unicode/unistr.h"
#include "unicode/uversion.h"
#include "umutex.h"
#include "utrie2.h"
U_NAMESPACE_BEGIN
// The current RBBI data format version.
static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {5, 0, 0, 0};
static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {6, 0, 0, 0};
/*
* The following structs map exactly onto the raw data from ICU common data file.
@@ -94,49 +95,61 @@ struct RBBIDataHeader {
struct RBBIStateTableRow {
int16_t fAccepting; /* Non-zero if this row is for an accepting state. */
/* Value 0: not an accepting state. */
/* -1: Unconditional Accepting state. */
/* positive: Look-ahead match has completed. */
/* Actual boundary position happened earlier */
/* Value here == fLookAhead in earlier */
/* state, at actual boundary pos. */
int16_t fLookAhead; /* Non-zero if this row is for a state that */
/* corresponds to a '/' in the rule source. */
/* Value is the same as the fAccepting */
/* value for the rule (which will appear */
/* in a different state. */
int16_t fTagIdx; /* Non-zero if this row covers a {tagged} position */
/* from a rule. Value is the index in the */
/* StatusTable of the set of matching */
/* tags (rule status values) */
int16_t fReserved;
uint16_t fNextState[1]; /* Next State, indexed by char category. */
/* Variable-length array declared with length 1 */
/* to disable bounds checkers. */
/* Array Size is actually fData->fHeader->fCatCount*/
/* CAUTION: see RBBITableBuilder::getTableSize() */
/* before changing anything here. */
template <typename T>
struct RBBIStateTableRowT {
T fAccepting; // Non-zero if this row is for an accepting state.
// Value 0: not an accepting state.
// 1: (ACCEPTING_UNCONDITIONAL) Unconditional Accepting state.
// >1: Look-ahead match has completed.
// Actual boundary position happened earlier.
// Value here == fLookAhead in earlier
// state, at actual boundary pos.
T fLookAhead; // Non-zero if this row is for a state that
// corresponds to a '/' in the rule source.
// Value is the same as the fAccepting
// value for the rule (which will appear
// in a different state.
T fTagsIdx; // Non-zero if this row covers a {tagged} position
// from a rule. Value is the index in the
// StatusTable of the set of matching
// tags (rule status values)
T fNextState[1]; // Next State, indexed by char category.
// Variable-length array declared with length 1
// to disable bounds checkers.
// Array Size is actually fData->fHeader->fCatCount
// CAUTION: see RBBITableBuilder::getTableSize()
// before changing anything here.
};
typedef RBBIStateTableRowT<uint8_t> RBBIStateTableRow8;
typedef RBBIStateTableRowT<uint16_t> RBBIStateTableRow16;
constexpr uint16_t ACCEPTING_UNCONDITIONAL = 1; // Value constant for RBBIStateTableRow::fAccepting
union RBBIStateTableRow {
RBBIStateTableRow16 r16;
RBBIStateTableRow8 r8;
};
struct RBBIStateTable {
uint32_t fNumStates; /* Number of states. */
uint32_t fRowLen; /* Length of a state table row, in bytes. */
uint32_t fFlags; /* Option Flags for this state table */
uint32_t fReserved; /* reserved */
char fTableData[1]; /* First RBBIStateTableRow begins here. */
/* Variable-length array declared with length 1 */
/* to disable bounds checkers. */
/* (making it char[] simplifies ugly address */
/* arithmetic for indexing variable length rows.) */
uint32_t fNumStates; // Number of states.
uint32_t fRowLen; // Length of a state table row, in bytes.
uint32_t fDictCategoriesStart; // Char category number of the first dictionary
// char class, or the the largest category number + 1
// if there are no dictionary categories.
uint32_t fLookAheadResultsSize; // Size of run-time array required for holding
// look-ahead results. Indexed by row.fLookAhead.
uint32_t fFlags; // Option Flags for this state table.
char fTableData[1]; // First RBBIStateTableRow begins here.
// Variable-length array declared with length 1
// to disable bounds checkers.
// (making it char[] simplifies ugly address
// arithmetic for indexing variable length rows.)
};
typedef enum {
RBBI_LOOKAHEAD_HARD_BREAK = 1,
RBBI_BOF_REQUIRED = 2
} RBBIStateTableFlags;
constexpr uint32_t RBBI_LOOKAHEAD_HARD_BREAK = 1;
constexpr uint32_t RBBI_BOF_REQUIRED = 2;
constexpr uint32_t RBBI_8BITS_ROWS = 4;
/* */
@@ -170,13 +183,13 @@ public:
const RBBIDataHeader *fHeader;
const RBBIStateTable *fForwardTable;
const RBBIStateTable *fReverseTable;
const UChar *fRuleSource;
const char *fRuleSource;
const int32_t *fRuleStatusTable;
/* number of int32_t values in the rule status table. Used to sanity check indexing */
int32_t fStatusMaxIdx;
UTrie2 *fTrie;
UCPTrie *fTrie;
private:
u_atomic_int32_t fRefCount;
@@ -184,8 +197,8 @@ private:
UnicodeString fRuleString;
UBool fDontFreeData;
RBBIDataWrapper(const RBBIDataWrapper &other); /* forbid copying of this class */
RBBIDataWrapper &operator=(const RBBIDataWrapper &other); /* forbid copying of this class */
RBBIDataWrapper(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */
RBBIDataWrapper &operator=(const RBBIDataWrapper &other) = delete; /* forbid copying of this class */
};
+1 -1
View File
@@ -79,7 +79,7 @@ class RBBINode : public UMemory {
// corresponds to columns in the final
// state transition table.
UBool fLookAheadEnd; // For endMark nodes, set TRUE if
UBool fLookAheadEnd; // For endMark nodes, set true if
// marking the end of a look-ahead rule.
UBool fRuleRoot; // True if this node is the root of a rule.
+28 -8
View File
@@ -22,6 +22,7 @@
#include "unicode/uniset.h"
#include "unicode/uchar.h"
#include "unicode/uchriter.h"
#include "unicode/ustring.h"
#include "unicode/parsepos.h"
#include "unicode/parseerr.h"
@@ -154,7 +155,14 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
int32_t reverseTableSize = align8(fForwardTable->getSafeTableSize());
int32_t trieSize = align8(fSetBuilder->getTrieSize());
int32_t statusTableSize = align8(fRuleStatusVals->size() * sizeof(int32_t));
int32_t rulesSize = align8((fStrippedRules.length()+1) * sizeof(UChar));
int32_t rulesLengthInUTF8 = 0;
u_strToUTF8WithSub(0, 0, &rulesLengthInUTF8,
fStrippedRules.getBuffer(), fStrippedRules.length(),
0xfffd, nullptr, fStatus);
*fStatus = U_ZERO_ERROR;
int32_t rulesSize = align8((rulesLengthInUTF8+1));
int32_t totalSize = headerSize
+ forwardTableSize
@@ -197,11 +205,11 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
data->fRTableLen = reverseTableSize;
data->fTrie = data->fRTable + data->fRTableLen;
data->fTrieLen = fSetBuilder->getTrieSize();
data->fStatusTable = data->fTrie + trieSize;
data->fTrieLen = trieSize;
data->fStatusTable = data->fTrie + data->fTrieLen;
data->fStatusTableLen= statusTableSize;
data->fRuleSource = data->fStatusTable + statusTableSize;
data->fRuleSourceLen = fStrippedRules.length() * sizeof(UChar);
data->fRuleSourceLen = rulesLengthInUTF8;
uprv_memset(data->fReserved, 0, sizeof(data->fReserved));
@@ -214,7 +222,12 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
ruleStatusTable[i] = fRuleStatusVals->elementAti(i);
}
fStrippedRules.extract((UChar *)((uint8_t *)data+data->fRuleSource), rulesSize/2+1, *fStatus);
u_strToUTF8WithSub((char *)data+data->fRuleSource, rulesSize, &rulesLengthInUTF8,
fStrippedRules.getBuffer(), fStrippedRules.length(),
0xfffd, nullptr, fStatus);
if (U_FAILURE(*fStatus)) {
return NULL;
}
return data;
}
@@ -274,9 +287,7 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
//
// UnicodeSet processing.
// Munge the Unicode Sets to create a set of character categories.
// Generate the mapping tables (TRIE) from input code points to
// the character categories.
// Munge the Unicode Sets to create an initial set of character categories.
//
fSetBuilder->buildRanges();
@@ -290,6 +301,12 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
}
fForwardTable->buildForwardTable();
// State table and character category optimization.
// Merge equivalent rows and columns.
// Note that this process alters the initial set of character categories,
// causing the representation of UnicodeSets in the parse tree to become invalid.
optimizeTables();
fForwardTable->buildSafeReverseTable(status);
@@ -302,6 +319,9 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
}
#endif
// Generate the mapping tables (TRIE) from input code points to
// the character categories.
//
fSetBuilder->buildTrie();
//
+1 -3
View File
@@ -829,16 +829,14 @@ static const UChar chRParen = 0x29;
UnicodeString RBBIRuleScanner::stripRules(const UnicodeString &rules) {
UnicodeString strippedRules;
int32_t rulesLength = rules.length();
bool skippingSpaces = false;
for (int32_t idx=0; idx<rulesLength; idx = rules.moveIndex32(idx, 1)) {
UChar32 cp = rules.char32At(idx);
bool whiteSpace = u_hasBinaryProperty(cp, UCHAR_PATTERN_WHITE_SPACE);
if (skippingSpaces && whiteSpace) {
if (whiteSpace) {
continue;
}
strippedRules.append(cp);
skippingSpaces = whiteSpace;
}
return strippedRules;
}
+1 -1
View File
@@ -54,7 +54,7 @@ public:
struct RBBIRuleChar {
UChar32 fChar;
UBool fEscaped;
RBBIRuleChar() : fChar(0), fEscaped(FALSE) {}
RBBIRuleChar() : fChar(0), fEscaped(false) {}
};
RBBIRuleScanner(RBBIRuleBuilder *rb);
+115 -105
View File
@@ -19,7 +19,7 @@
// by the RBBI rules.
// - compute a set of non-overlapping character ranges
// with all characters within a range belonging to the same
// set of input uniocde sets.
// set of input unicode sets.
// - Derive a set of non-overlapping UnicodeSet (like things)
// that will correspond to columns in the state table for
// the RBBI execution engine. All characters within one
@@ -35,7 +35,6 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/uniset.h"
#include "utrie2.h"
#include "uvector.h"
#include "uassert.h"
#include "cmemory.h"
@@ -46,6 +45,7 @@
U_NAMESPACE_BEGIN
const int32_t kMaxCharCategoriesFor8BitsTrie = 255;
//------------------------------------------------------------------------
//
// Constructor
@@ -55,11 +55,12 @@ RBBISetBuilder::RBBISetBuilder(RBBIRuleBuilder *rb)
{
fRB = rb;
fStatus = rb->fStatus;
fRangeList = 0;
fTrie = 0;
fRangeList = nullptr;
fMutableTrie = nullptr;
fTrie = nullptr;
fTrieSize = 0;
fGroupCount = 0;
fSawBOF = FALSE;
fSawBOF = false;
}
@@ -79,7 +80,8 @@ RBBISetBuilder::~RBBISetBuilder()
delete r;
}
utrie2_close(fTrie);
ucptrie_close(fTrie);
umutablecptrie_close(fMutableTrie);
}
@@ -194,25 +196,48 @@ void RBBISetBuilder::buildRanges() {
//
// Numbering: # 0 (state table column 0) is unused.
// # 1 is reserved - table column 1 is for end-of-input
// # 2 is reserved - table column 2 is for beginning-in-input
// # 2 is reserved - table column 2 is for beginning-of-input
// # 3 is the first range list.
//
RangeDescriptor *rlSearchRange;
for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) {
int32_t dictGroupCount = 0;
for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) {
for (rlSearchRange=fRangeList; rlSearchRange != rlRange; rlSearchRange=rlSearchRange->fNext) {
if (rlRange->fIncludesSets->equals(*rlSearchRange->fIncludesSets)) {
rlRange->fNum = rlSearchRange->fNum;
rlRange->fIncludesDict = rlSearchRange->fIncludesDict;
break;
}
}
if (rlRange->fNum == 0) {
fGroupCount ++;
rlRange->fNum = fGroupCount+2;
rlRange->setDictionaryFlag();
addValToSets(rlRange->fIncludesSets, fGroupCount+2);
rlRange->fFirstInGroup = true;
if (rlRange->isDictionaryRange()) {
rlRange->fNum = ++dictGroupCount;
rlRange->fIncludesDict = true;
} else {
fGroupCount++;
rlRange->fNum = fGroupCount+2;
addValToSets(rlRange->fIncludesSets, rlRange->fNum);
}
}
}
// Move the character category numbers for any dictionary ranges up, so that they
// immediately follow the non-dictionary ranges.
fDictCategoriesStart = fGroupCount + 3;
for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) {
if (rlRange->fIncludesDict) {
rlRange->fNum += fDictCategoriesStart - 1;
if (rlRange->fFirstInGroup) {
addValToSets(rlRange->fIncludesSets, rlRange->fNum);
}
}
}
fGroupCount += dictGroupCount;
// Handle input sets that contain the special string {eof}.
// Column 1 of the state table is reserved for EOF on input.
// Column 2 is reserved for before-the-start-input.
@@ -220,13 +245,11 @@ void RBBISetBuilder::buildRanges() {
// references to {bof}.)
// Add this column value (1 or 2) to the equivalent expression
// subtree for each UnicodeSet that contains the string {eof}
// Because {bof} and {eof} are not a characters in the normal sense,
// they doesn't affect the computation of ranges or TRIE.
static const UChar eofUString[] = {0x65, 0x6f, 0x66, 0};
static const UChar bofUString[] = {0x62, 0x6f, 0x66, 0};
// Because {bof} and {eof} are not characters in the normal sense,
// they don't affect the computation of the ranges or TRIE.
UnicodeString eofString(eofUString);
UnicodeString bofString(bofUString);
UnicodeString eofString(u"eof");
UnicodeString bofString(u"bof");
for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules
usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni);
if (usetNode==NULL) {
@@ -253,19 +276,17 @@ void RBBISetBuilder::buildRanges() {
// range group number.
//
void RBBISetBuilder::buildTrie() {
RangeDescriptor *rlRange;
fTrie = utrie2_open(0, // Initial value for all code points.
fMutableTrie = umutablecptrie_open(
0, // Initial value for all code points.
0, // Error value for out-of-range input.
fStatus);
for (rlRange = fRangeList; rlRange!=0 && U_SUCCESS(*fStatus); rlRange=rlRange->fNext) {
utrie2_setRange32(fTrie,
rlRange->fStartChar, // Range start
rlRange->fEndChar, // Range end (inclusive)
rlRange->fNum, // value for range
TRUE, // Overwrite previously written values
fStatus);
for (RangeDescriptor *range = fRangeList; range!=nullptr && U_SUCCESS(*fStatus); range=range->fNext) {
umutablecptrie_setRange(fMutableTrie,
range->fStartChar, // Range start
range->fEndChar, // Range end (inclusive)
range->fNum, // value for range
fStatus);
}
}
@@ -273,16 +294,21 @@ void RBBISetBuilder::buildTrie() {
void RBBISetBuilder::mergeCategories(IntPair categories) {
U_ASSERT(categories.first >= 1);
U_ASSERT(categories.second > categories.first);
U_ASSERT((categories.first < fDictCategoriesStart && categories.second < fDictCategoriesStart) ||
(categories.first >= fDictCategoriesStart && categories.second >= fDictCategoriesStart));
for (RangeDescriptor *rd = fRangeList; rd != nullptr; rd = rd->fNext) {
int32_t rangeNum = rd->fNum & ~DICT_BIT;
int32_t rangeDict = rd->fNum & DICT_BIT;
int32_t rangeNum = rd->fNum;
if (rangeNum == categories.second) {
rd->fNum = categories.first | rangeDict;
rd->fNum = categories.first;
} else if (rangeNum > categories.second) {
rd->fNum--;
}
}
--fGroupCount;
if (categories.second <= fDictCategoriesStart) {
--fDictCategoriesStart;
}
}
@@ -295,15 +321,18 @@ int32_t RBBISetBuilder::getTrieSize() {
if (U_FAILURE(*fStatus)) {
return 0;
}
utrie2_freeze(fTrie, UTRIE2_16_VALUE_BITS, fStatus);
fTrieSize = utrie2_serialize(fTrie,
NULL, // Buffer
0, // Capacity
fStatus);
if (*fStatus == U_BUFFER_OVERFLOW_ERROR) {
*fStatus = U_ZERO_ERROR;
if (fTrie == nullptr) {
bool use8Bits = getNumCharCategories() <= kMaxCharCategoriesFor8BitsTrie;
fTrie = umutablecptrie_buildImmutable(
fMutableTrie,
UCPTRIE_TYPE_FAST,
use8Bits ? UCPTRIE_VALUE_BITS_8 : UCPTRIE_VALUE_BITS_16,
fStatus);
fTrieSize = ucptrie_toBinary(fTrie, nullptr, 0, fStatus);
if (*fStatus == U_BUFFER_OVERFLOW_ERROR) {
*fStatus = U_ZERO_ERROR;
}
}
// RBBIDebugPrintf("Trie table size is %d\n", trieSize);
return fTrieSize;
}
@@ -316,9 +345,9 @@ int32_t RBBISetBuilder::getTrieSize() {
//
//-----------------------------------------------------------------------------------
void RBBISetBuilder::serializeTrie(uint8_t *where) {
utrie2_serialize(fTrie,
where, // Buffer
fTrieSize, // Capacity
ucptrie_toBinary(fTrie,
where, // Buffer
fTrieSize, // Capacity
fStatus);
}
@@ -384,6 +413,16 @@ int32_t RBBISetBuilder::getNumCharCategories() const {
}
//------------------------------------------------------------------------
//
// getDictCategoriesStart
//
//------------------------------------------------------------------------
int32_t RBBISetBuilder::getDictCategoriesStart() const {
return fDictCategoriesStart;
}
//------------------------------------------------------------------------
//
// sawBOF
@@ -403,7 +442,7 @@ UBool RBBISetBuilder::sawBOF() const {
UChar32 RBBISetBuilder::getFirstChar(int32_t category) const {
RangeDescriptor *rlRange;
UChar32 retVal = (UChar32)-1;
for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) {
for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) {
if (rlRange->fNum == category) {
retVal = rlRange->fStartChar;
break;
@@ -413,7 +452,6 @@ UChar32 RBBISetBuilder::getFirstChar(int32_t category) const {
}
//------------------------------------------------------------------------
//
// printRanges A debugging function.
@@ -426,16 +464,16 @@ void RBBISetBuilder::printRanges() {
int i;
RBBIDebugPrintf("\n\n Nonoverlapping Ranges ...\n");
for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) {
RBBIDebugPrintf("%2i %4x-%4x ", rlRange->fNum, rlRange->fStartChar, rlRange->fEndChar);
for (rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) {
RBBIDebugPrintf("%4x-%4x ", rlRange->fStartChar, rlRange->fEndChar);
for (i=0; i<rlRange->fIncludesSets->size(); i++) {
RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i);
UnicodeString setName = UNICODE_STRING("anon", 4);
UnicodeString setName {u"anon"};
RBBINode *setRef = usetNode->fParent;
if (setRef != NULL) {
if (setRef != nullptr) {
RBBINode *varRef = setRef->fParent;
if (varRef != NULL && varRef->fType == RBBINode::varRef) {
if (varRef != nullptr && varRef->fType == RBBINode::varRef) {
setName = varRef->fText;
}
}
@@ -455,19 +493,15 @@ void RBBISetBuilder::printRanges() {
//------------------------------------------------------------------------
#ifdef RBBI_DEBUG
void RBBISetBuilder::printRangeGroups() {
RangeDescriptor *rlRange;
RangeDescriptor *tRange;
int i;
int lastPrintedGroupNum = 0;
RBBIDebugPrintf("\nRanges grouped by Unicode Set Membership...\n");
for (rlRange = fRangeList; rlRange!=0; rlRange=rlRange->fNext) {
int groupNum = rlRange->fNum & 0xbfff;
if (groupNum > lastPrintedGroupNum) {
lastPrintedGroupNum = groupNum;
for (RangeDescriptor *rlRange = fRangeList; rlRange!=nullptr; rlRange=rlRange->fNext) {
if (rlRange->fFirstInGroup) {
int groupNum = rlRange->fNum;
RBBIDebugPrintf("%2i ", groupNum);
if (rlRange->fNum & DICT_BIT) { RBBIDebugPrintf(" <DICT> ");}
if (groupNum >= fDictCategoriesStart) { RBBIDebugPrintf(" <DICT> ");}
for (i=0; i<rlRange->fIncludesSets->size(); i++) {
RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i);
@@ -483,7 +517,7 @@ void RBBISetBuilder::printRangeGroups() {
}
i = 0;
for (tRange = rlRange; tRange != 0; tRange = tRange->fNext) {
for (RangeDescriptor *tRange = rlRange; tRange != nullptr; tRange = tRange->fNext) {
if (tRange->fNum == rlRange->fNum) {
if (i++ % 5 == 0) {
RBBIDebugPrintf("\n ");
@@ -550,28 +584,22 @@ void RBBISetBuilder::printSets() {
//
//-------------------------------------------------------------------------------------
RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) {
int i;
RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &status) :
fStartChar(other.fStartChar), fEndChar {other.fEndChar}, fNum {other.fNum},
fIncludesDict{other.fIncludesDict}, fFirstInGroup{other.fFirstInGroup} {
this->fStartChar = other.fStartChar;
this->fEndChar = other.fEndChar;
this->fNum = other.fNum;
this->fNext = NULL;
UErrorCode oldstatus = status;
this->fIncludesSets = new UVector(status);
if (U_FAILURE(oldstatus)) {
status = oldstatus;
if (U_FAILURE(status)) {
return;
}
fIncludesSets = new UVector(status);
if (this->fIncludesSets == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(status)) {
return;
}
/* test for NULL */
if (this->fIncludesSets == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
for (i=0; i<other.fIncludesSets->size(); i++) {
for (int32_t i=0; i<other.fIncludesSets->size(); i++) {
this->fIncludesSets->addElement(other.fIncludesSets->elementAt(i), status);
}
}
@@ -583,24 +611,13 @@ RangeDescriptor::RangeDescriptor(const RangeDescriptor &other, UErrorCode &statu
//
//-------------------------------------------------------------------------------------
RangeDescriptor::RangeDescriptor(UErrorCode &status) {
this->fStartChar = 0;
this->fEndChar = 0;
this->fNum = 0;
this->fNext = NULL;
UErrorCode oldstatus = status;
this->fIncludesSets = new UVector(status);
if (U_FAILURE(oldstatus)) {
status = oldstatus;
}
if (U_FAILURE(status)) {
return;
}
/* test for NULL */
if(this->fIncludesSets == 0) {
fIncludesSets = new UVector(status);
if (fIncludesSets == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
@@ -611,7 +628,7 @@ RangeDescriptor::RangeDescriptor(UErrorCode &status) {
//-------------------------------------------------------------------------------------
RangeDescriptor::~RangeDescriptor() {
delete fIncludesSets;
fIncludesSets = NULL;
fIncludesSets = nullptr;
}
//-------------------------------------------------------------------------------------
@@ -622,7 +639,7 @@ RangeDescriptor::~RangeDescriptor() {
void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
U_ASSERT(where>fStartChar && where<=fEndChar);
RangeDescriptor *nr = new RangeDescriptor(*this, status);
if(nr == 0) {
if(nr == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -641,27 +658,22 @@ void RangeDescriptor::split(UChar32 where, UErrorCode &status) {
//-------------------------------------------------------------------------------------
//
// RangeDescriptor::setDictionaryFlag
// RangeDescriptor::isDictionaryRange
//
// Character Category Numbers that include characters from
// the original Unicode Set named "dictionary" have bit 14
// set to 1. The RBBI runtime engine uses this to trigger
// use of the word dictionary.
// Test whether this range includes characters from
// the original Unicode Set named "dictionary".
//
// This function looks through the Unicode Sets that it
// (the range) includes, and sets the bit in fNum when
// "dictionary" is among them.
// This function looks through the Unicode Sets that
// the range includes, checking for one named "dictionary"
//
// TODO: a faster way would be to find the set node for
// "dictionary" just once, rather than looking it
// up by name every time.
//
//-------------------------------------------------------------------------------------
void RangeDescriptor::setDictionaryFlag() {
int i;
bool RangeDescriptor::isDictionaryRange() {
static const char16_t *dictionary = u"dictionary";
for (i=0; i<fIncludesSets->size(); i++) {
for (int32_t i=0; i<fIncludesSets->size(); i++) {
RBBINode *usetNode = (RBBINode *)fIncludesSets->elementAt(i);
RBBINode *setRef = usetNode->fParent;
if (setRef != nullptr) {
@@ -669,16 +681,14 @@ void RangeDescriptor::setDictionaryFlag() {
if (varRef && varRef->fType == RBBINode::varRef) {
const UnicodeString *setName = &varRef->fText;
if (setName->compare(dictionary, -1) == 0) {
fNum |= RBBISetBuilder::DICT_BIT;
break;
return true;
}
}
}
}
return false;
}
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+24 -24
View File
@@ -16,9 +16,10 @@
#if !UCONFIG_NO_BREAK_ITERATION
#include "unicode/ucptrie.h"
#include "unicode/umutablecptrie.h"
#include "unicode/uobject.h"
#include "rbbirb.h"
#include "utrie2.h"
#include "uvector.h"
U_NAMESPACE_BEGIN
@@ -40,25 +41,26 @@ U_NAMESPACE_BEGIN
//
class RangeDescriptor : public UMemory {
public:
UChar32 fStartChar; // Start of range, unicode 32 bit value.
UChar32 fEndChar; // End of range, unicode 32 bit value.
int32_t fNum; // runtime-mapped input value for this range.
UVector *fIncludesSets; // vector of the the original
// Unicode sets that include this range.
// (Contains ptrs to uset nodes)
RangeDescriptor *fNext; // Next RangeDescriptor in the linked list.
UChar32 fStartChar {}; // Start of range, unicode 32 bit value.
UChar32 fEndChar {}; // End of range, unicode 32 bit value.
int32_t fNum {0}; // runtime-mapped input value for this range.
bool fIncludesDict {false}; // True if the range includes $dictionary.
bool fFirstInGroup {false}; // True if first range in a group with the same fNum.
UVector *fIncludesSets {nullptr}; // vector of the the original
// Unicode sets that include this range.
// (Contains ptrs to uset nodes)
RangeDescriptor *fNext {nullptr}; // Next RangeDescriptor in the linked list.
RangeDescriptor(UErrorCode &status);
RangeDescriptor(const RangeDescriptor &other, UErrorCode &status);
~RangeDescriptor();
void split(UChar32 where, UErrorCode &status); // Spit this range in two at "where", with
// where appearing in the second (higher) part.
void setDictionaryFlag(); // Check whether this range appears as part of
bool isDictionaryRange(); // Check whether this range appears as part of
// the Unicode set named "dictionary"
private:
RangeDescriptor(const RangeDescriptor &other); // forbid copying of this class
RangeDescriptor &operator=(const RangeDescriptor &other); // forbid copying of this class
RangeDescriptor(const RangeDescriptor &other) = delete; // forbid default copying of this class
RangeDescriptor &operator=(const RangeDescriptor &other) = delete; // forbid assigning of this class
};
@@ -89,6 +91,8 @@ public:
int32_t getNumCharCategories() const; // CharCategories are the same as input symbol set to the
// runtime state machine, which are the same as
// columns in the DFA state table
int32_t getDictCategoriesStart() const; // First char category that includes $dictionary, or
// last category + 1 if there are no dictionary categories.
int32_t getTrieSize() /*const*/; // Size in bytes of the serialized Trie.
void serializeTrie(uint8_t *where); // write out the serialized Trie.
UChar32 getFirstChar(int32_t val) const;
@@ -101,8 +105,6 @@ public:
*/
void mergeCategories(IntPair categories);
static constexpr int32_t DICT_BIT = 0x4000;
#ifdef RBBI_DEBUG
void printSets();
void printRanges();
@@ -114,24 +116,22 @@ public:
#endif
private:
void numberSets();
RBBIRuleBuilder *fRB; // The RBBI Rule Compiler that owns us.
UErrorCode *fStatus;
RangeDescriptor *fRangeList; // Head of the linked list of RangeDescriptors
UTrie2 *fTrie; // The mapping TRIE that is the end result of processing
uint32_t fTrieSize; // the Unicode Sets.
UMutableCPTrie *fMutableTrie; // The mapping TRIE that is the end result of processing
UCPTrie *fTrie; // the Unicode Sets.
uint32_t fTrieSize;
// Groups correspond to character categories -
// groups of ranges that are in the same original UnicodeSets.
// fGroupCount is the index of the last used group.
// fGroupCount+1 is also the number of columns in the RBBI state table being compiled.
// State table column 0 is not used. Column 1 is for end-of-input.
// column 2 is for group 0. Funny counting.
// Number of range groups, which are groups of ranges that are in the same original UnicodeSets.
int32_t fGroupCount;
// The number of the first dictionary char category.
// If there are no Dictionary categories, set to the last category + 1.
int32_t fDictCategoriesStart;
UBool fSawBOF;
RBBISetBuilder(const RBBISetBuilder &other); // forbid copying of this class
+84 -30
View File
@@ -28,6 +28,8 @@
U_NAMESPACE_BEGIN
const int32_t kMaxStateFor8BitsTable = 255;
RBBITableBuilder::RBBITableBuilder(RBBIRuleBuilder *rb, RBBINode **rootNode, UErrorCode &status) :
fRB(rb),
fTree(*rootNode),
@@ -712,7 +714,6 @@ void RBBITableBuilder::mapLookAheadRules() {
return;
}
fLookAheadRuleMap->setSize(fRB->fScanner->numRules() + 1);
int32_t laSlotsInUse = 0;
for (int32_t n=0; n<fDStates->size(); n++) {
RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n);
@@ -749,7 +750,7 @@ void RBBITableBuilder::mapLookAheadRules() {
}
if (laSlotForState == 0) {
laSlotForState = ++laSlotsInUse;
laSlotForState = ++fLASlotsInUse;
}
// For each look ahead node covered by this state,
@@ -805,23 +806,23 @@ void RBBITableBuilder::flagAcceptingStates() {
if (sd->fPositions->indexOf(endMarker) >= 0) {
// Any non-zero value for fAccepting means this is an accepting node.
// The value is what will be returned to the user as the break status.
// If no other value was specified, force it to -1.
// If no other value was specified, force it to ACCEPTING_UNCONDITIONAL (1).
if (sd->fAccepting==0) {
// State hasn't been marked as accepting yet. Do it now.
sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal);
if (sd->fAccepting == 0) {
sd->fAccepting = -1;
sd->fAccepting = ACCEPTING_UNCONDITIONAL;
}
}
if (sd->fAccepting==-1 && endMarker->fVal != 0) {
if (sd->fAccepting==ACCEPTING_UNCONDITIONAL && endMarker->fVal != 0) {
// Both lookahead and non-lookahead accepting for this state.
// Favor the look-ahead, because a look-ahead match needs to
// immediately stop the run-time engine. First match, not longest.
sd->fAccepting = fLookAheadRuleMap->elementAti(endMarker->fVal);
}
// implicit else:
// if sd->fAccepting already had a value other than 0 or -1, leave it be.
// if sd->fAccepting already had a value other than 0 or 1, leave it be.
}
}
}
@@ -855,7 +856,7 @@ void RBBITableBuilder::flagLookAheadStates() {
int32_t positionsIdx = sd->fPositions->indexOf(lookAheadNode);
if (positionsIdx >= 0) {
U_ASSERT(lookAheadNode == sd->fPositions->elementAt(positionsIdx));
int32_t lookaheadSlot = fLookAheadRuleMap->elementAti(lookAheadNode->fVal);
uint32_t lookaheadSlot = fLookAheadRuleMap->elementAti(lookAheadNode->fVal);
U_ASSERT(sd->fLookAhead == 0 || sd->fLookAhead == lookaheadSlot);
// if (sd->fLookAhead != 0 && sd->fLookAhead != lookaheadSlot) {
// printf("%s:%d Bingo. sd->fLookAhead:%d lookaheadSlot:%d\n",
@@ -1148,7 +1149,13 @@ bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) {
int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
for (; categories->first < numCols-1; categories->first++) {
for (categories->second=categories->first+1; categories->second < numCols; categories->second++) {
// Note: dictionary & non-dictionary columns cannot be merged.
// The limitSecond value prevents considering mixed pairs.
// Dictionary categories are >= DictCategoriesStart.
// Non dict categories are < DictCategoriesStart.
int limitSecond = categories->first < fRB->fSetBuilder->getDictCategoriesStart() ?
fRB->fSetBuilder->getDictCategoriesStart() : numCols;
for (categories->second=categories->first+1; categories->second < limitSecond; categories->second++) {
// Initialized to different values to prevent returning true if numStates = 0 (implies no duplicates).
uint16_t table_base = 0;
uint16_t table_dupl = 1;
@@ -1335,11 +1342,18 @@ int32_t RBBITableBuilder::getTableSize() const {
numRows = fDStates->size();
numCols = fRB->fSetBuilder->getNumCharCategories();
rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
if (use8BitsForTable()) {
rowSize = offsetof(RBBIStateTableRow8, fNextState) + sizeof(int8_t)*numCols;
} else {
rowSize = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t)*numCols;
}
size += numRows * rowSize;
return size;
}
bool RBBITableBuilder::use8BitsForTable() const {
return fDStates->size() <= kMaxStateFor8BitsTable;
}
//-----------------------------------------------------------------------------
//
@@ -1364,27 +1378,47 @@ void RBBITableBuilder::exportTable(void *where) {
return;
}
table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
table->fNumStates = fDStates->size();
table->fDictCategoriesStart = fRB->fSetBuilder->getDictCategoriesStart();
table->fLookAheadResultsSize = fLASlotsInUse == ACCEPTING_UNCONDITIONAL ? 0 : fLASlotsInUse + 1;
table->fFlags = 0;
if (use8BitsForTable()) {
table->fRowLen = offsetof(RBBIStateTableRow8, fNextState) + sizeof(uint8_t) * catCount;
table->fFlags |= RBBI_8BITS_ROWS;
} else {
table->fRowLen = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t) * catCount;
}
if (fRB->fLookAheadHardBreak) {
table->fFlags |= RBBI_LOOKAHEAD_HARD_BREAK;
}
if (fRB->fSetBuilder->sawBOF()) {
table->fFlags |= RBBI_BOF_REQUIRED;
}
table->fReserved = 0;
for (state=0; state<table->fNumStates; state++) {
RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen);
U_ASSERT (-32768 < sd->fAccepting && sd->fAccepting <= 32767);
U_ASSERT (-32768 < sd->fLookAhead && sd->fLookAhead <= 32767);
row->fAccepting = (int16_t)sd->fAccepting;
row->fLookAhead = (int16_t)sd->fLookAhead;
row->fTagIdx = (int16_t)sd->fTagsIdx;
for (col=0; col<catCount; col++) {
row->fNextState[col] = (uint16_t)sd->fDtran->elementAti(col);
if (use8BitsForTable()) {
U_ASSERT (sd->fAccepting <= 255);
U_ASSERT (sd->fLookAhead <= 255);
U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 255);
row->r8.fAccepting = sd->fAccepting;
row->r8.fLookAhead = sd->fLookAhead;
row->r8.fTagsIdx = sd->fTagsIdx;
for (col=0; col<catCount; col++) {
U_ASSERT (sd->fDtran->elementAti(col) <= kMaxStateFor8BitsTable);
row->r8.fNextState[col] = sd->fDtran->elementAti(col);
}
} else {
U_ASSERT (sd->fAccepting <= 0xffff);
U_ASSERT (sd->fLookAhead <= 0xffff);
U_ASSERT (0 <= sd->fTagsIdx && sd->fTagsIdx <= 0xffff);
row->r16.fAccepting = sd->fAccepting;
row->r16.fLookAhead = sd->fLookAhead;
row->r16.fTagsIdx = sd->fTagsIdx;
for (col=0; col<catCount; col++) {
row->r16.fNextState[col] = sd->fDtran->elementAti(col);
}
}
}
}
@@ -1520,11 +1554,18 @@ int32_t RBBITableBuilder::getSafeTableSize() const {
numRows = fSafeTable->size();
numCols = fRB->fSetBuilder->getNumCharCategories();
rowSize = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t)*numCols;
if (use8BitsForSafeTable()) {
rowSize = offsetof(RBBIStateTableRow8, fNextState) + sizeof(int8_t)*numCols;
} else {
rowSize = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t)*numCols;
}
size += numRows * rowSize;
return size;
}
bool RBBITableBuilder::use8BitsForSafeTable() const {
return fSafeTable->size() <= kMaxStateFor8BitsTable;
}
//-----------------------------------------------------------------------------
//
@@ -1549,20 +1590,33 @@ void RBBITableBuilder::exportSafeTable(void *where) {
return;
}
table->fRowLen = offsetof(RBBIStateTableRow, fNextState) + sizeof(uint16_t) * catCount;
table->fNumStates = fSafeTable->size();
table->fFlags = 0;
table->fReserved = 0;
if (use8BitsForSafeTable()) {
table->fRowLen = offsetof(RBBIStateTableRow8, fNextState) + sizeof(uint8_t) * catCount;
table->fFlags |= RBBI_8BITS_ROWS;
} else {
table->fRowLen = offsetof(RBBIStateTableRow16, fNextState) + sizeof(int16_t) * catCount;
}
for (state=0; state<table->fNumStates; state++) {
UnicodeString *rowString = (UnicodeString *)fSafeTable->elementAt(state);
RBBIStateTableRow *row = (RBBIStateTableRow *)(table->fTableData + state*table->fRowLen);
row->fAccepting = 0;
row->fLookAhead = 0;
row->fTagIdx = 0;
row->fReserved = 0;
for (col=0; col<catCount; col++) {
row->fNextState[col] = rowString->charAt(col);
if (use8BitsForSafeTable()) {
row->r8.fAccepting = 0;
row->r8.fLookAhead = 0;
row->r8.fTagsIdx = 0;
for (col=0; col<catCount; col++) {
U_ASSERT(rowString->charAt(col) <= kMaxStateFor8BitsTable);
row->r8.fNextState[col] = static_cast<uint8_t>(rowString->charAt(col));
}
} else {
row->r16.fAccepting = 0;
row->r16.fLookAhead = 0;
row->r16.fTagsIdx = 0;
for (col=0; col<catCount; col++) {
row->r16.fNextState[col] = rowString->charAt(col);
}
}
}
}
@@ -1600,12 +1654,12 @@ void RBBITableBuilder::printStates() {
RBBIDebugPrintf("state | i n p u t s y m b o l s \n");
RBBIDebugPrintf(" | Acc LA Tag");
for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
RBBIDebugPrintf(" %2d", c);
RBBIDebugPrintf(" %3d", c);
}
RBBIDebugPrintf("\n");
RBBIDebugPrintf(" |---------------");
for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
RBBIDebugPrintf("---");
RBBIDebugPrintf("----");
}
RBBIDebugPrintf("\n");
@@ -1614,7 +1668,7 @@ void RBBITableBuilder::printStates() {
RBBIDebugPrintf(" %3d | " , n);
RBBIDebugPrintf("%3d %3d %5d ", sd->fAccepting, sd->fLookAhead, sd->fTagsIdx);
for (c=0; c<fRB->fSetBuilder->getNumCharCategories(); c++) {
RBBIDebugPrintf(" %2d", sd->fDtran->elementAti(c));
RBBIDebugPrintf(" %3d", sd->fDtran->elementAti(c));
}
RBBIDebugPrintf("\n");
}
+16 -4
View File
@@ -20,6 +20,7 @@
#include "unicode/uobject.h"
#include "unicode/rbbi.h"
#include "rbbidata.h"
#include "rbbirb.h"
#include "rbbinode.h"
@@ -53,6 +54,9 @@ public:
*/
void exportTable(void *where);
/** Use 8 bits to encode the forward table */
bool use8BitsForTable() const;
/**
* Find duplicate (redundant) character classes. Begin looking with categories.first.
* Duplicate, if found are returned in the categories parameter.
@@ -85,6 +89,8 @@ public:
*/
void exportSafeTable(void *where);
/** Use 8 bits to encode the safe reverse table */
bool use8BitsForSafeTable() const;
private:
void calcNullable(RBBINode *n);
@@ -179,9 +185,15 @@ private:
/** Map from rule number (fVal in look ahead nodes) to sequential lookahead index. */
UVector32 *fLookAheadRuleMap = nullptr;
/* Counter used when assigning lookahead rule numbers.
* Contains the last look-ahead number already in use.
* The first look-ahead number is 2; Number 1 (ACCEPTING_UNCONDITIONAL) is reserved
* for non-lookahead accepting states. See the declarations of RBBIStateTableRowT. */
int32_t fLASlotsInUse = ACCEPTING_UNCONDITIONAL;
RBBITableBuilder(const RBBITableBuilder &other); // forbid copying of this class
RBBITableBuilder &operator=(const RBBITableBuilder &other); // forbid copying of this class
RBBITableBuilder(const RBBITableBuilder &other) = delete; // forbid copying of this class
RBBITableBuilder &operator=(const RBBITableBuilder &other) = delete; // forbid copying of this class
};
//
@@ -190,8 +202,8 @@ private:
class RBBIStateDescriptor : public UMemory {
public:
UBool fMarked;
int32_t fAccepting;
int32_t fLookAhead;
uint32_t fAccepting;
uint32_t fLookAhead;
UVector *fTagVals;
int32_t fTagsIdx;
UVector *fPositions; // Set of parse tree positions associated
+6 -6
View File
@@ -60,7 +60,7 @@ public:
/**
* @param i Array item index.
* @param value Output-only, receives the value of the i'th item.
* @return TRUE if i is non-negative and less than getSize().
* @return true if i is non-negative and less than getSize().
*/
UBool getValue(int32_t i, ResourceValue &value) const;
@@ -97,14 +97,14 @@ public:
* @param i Table item index.
* @param key Output-only, receives the key of the i'th item.
* @param value Output-only, receives the value of the i'th item.
* @return TRUE if i is non-negative and less than getSize().
* @return true if i is non-negative and less than getSize().
*/
UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const;
/**
* @param key Key string to find in the table.
* @param value Output-only, receives the value of the item with that key.
* @return TRUE if the table contains the key.
* @return true if the table contains the key.
*/
UBool findValue(const char *key, ResourceValue &value) const;
@@ -141,7 +141,7 @@ public:
inline UnicodeString getUnicodeString(UErrorCode &errorCode) const {
int32_t len = 0;
const UChar *r = getString(len, errorCode);
return UnicodeString(TRUE, r, len);
return UnicodeString(true, r, len);
}
/**
@@ -152,7 +152,7 @@ public:
inline UnicodeString getAliasUnicodeString(UErrorCode &errorCode) const {
int32_t len = 0;
const UChar *r = getAliasString(len, errorCode);
return UnicodeString(TRUE, r, len);
return UnicodeString(true, r, len);
}
/**
@@ -199,7 +199,7 @@ public:
* CLDR no-fallback data values of (three empty-set symbols)=={2205, 2205, 2205}
* when enumerating tables with fallback from the specific resource bundle to root.
*
* @return TRUE if this is a no-inheritance marker string
* @return true if this is a no-inheritance marker string
*/
virtual UBool isNoInheritanceMarker() const = 0;
+1 -1
View File
@@ -114,7 +114,7 @@ public:
* character.
* @param options one or more of the following options, bitwise-OR-ed
* together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE.
* @param isEscaped output parameter set to TRUE if the character
* @param isEscaped output parameter set to true if the character
* was escaped
* @param ec input-output error code. An error will only be set by
* this routing if options includes PARSE_VARIABLES and an unknown
+19 -19
View File
@@ -138,16 +138,16 @@ class U_COMMON_API ICUServiceKey : public UObject {
* must eventually return false. This implementation has no fallbacks
* and always returns false.</p>
*
* @return TRUE if the ICUServiceKey changed to a valid fallback value.
* @return true if the ICUServiceKey changed to a valid fallback value.
*/
virtual UBool fallback();
/**
* <p>Return TRUE if a key created from id matches, or would eventually
* <p>Return true if a key created from id matches, or would eventually
* fallback to match, the canonical ID of this ICUServiceKey.</p>
*
* @param id the id to test.
* @return TRUE if this ICUServiceKey's canonical ID is a fallback of id.
* @return true if this ICUServiceKey's canonical ID is a fallback of id.
*/
virtual UBool isFallbackOf(const UnicodeString& id) const;
@@ -291,15 +291,15 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
public:
/**
* <p>Construct a SimpleFactory that maps a single ID to a single
* service instance. If visible is TRUE, the ID will be visible.
* service instance. If visible is true, the ID will be visible.
* The instance must not be NULL. The SimpleFactory will adopt
* the instance, which must not be changed subsequent to this call.</p>
*
* @param instanceToAdopt the service instance to adopt.
* @param id the ID to assign to this service instance.
* @param visible if TRUE, the ID will be visible.
* @param visible if true, the ID will be visible.
*/
SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = TRUE);
SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible = true);
/**
* <p>Destructor.</p>
@@ -318,7 +318,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const;
/**
* <p>This implementation adds a mapping from ID -> this to result if visible is TRUE,
* <p>This implementation adds a mapping from ID -> this to result if visible is true,
* otherwise it removes ID from result.</p>
*
* @param result the mapping table to update.
@@ -327,7 +327,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const;
/**
* <p>This implementation returns the factory ID if it equals id and visible is TRUE,
* <p>This implementation returns the factory ID if it equals id and visible is true,
* otherwise it returns the empty string. (This implementation provides
* no localized id information.)</p>
*
@@ -427,8 +427,8 @@ public:
UErrorCode& status);
/**
* <p>Return TRUE if either string of the pair is bogus.</p>
* @return TRUE if either string of the pair is bogus.
* <p>Return true if either string of the pair is bogus.</p>
* @return true if either string of the pair is bogus.
*/
UBool isBogus() const;
@@ -761,7 +761,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* <p>A convenience override of registerInstance(UObject*, const UnicodeString&, UBool)
* that defaults visible to TRUE.</p>
* that defaults visible to true.</p>
*
* @param objToAdopt the object to register and adopt.
* @param id the ID to assign to this object.
@@ -774,7 +774,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* <p>Register a service instance with the provided ID. The ID will be
* canonicalized. The canonicalized ID will be returned by
* getVisibleIDs if visible is TRUE. The service instance will be adopted and
* getVisibleIDs if visible is true. The service instance will be adopted and
* must not be modified subsequent to this call.</p>
*
* <p>This issues a serviceChanged notification to registered listeners.</p>
@@ -784,7 +784,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param objToAdopt the object to register and adopt.
* @param id the ID to assign to this object.
* @param visible TRUE if getVisibleIDs is to return this ID.
* @param visible true if getVisibleIDs is to return this ID.
* @param status the error code status.
* @return a registry key that can be passed to unregister() to unregister
* (and discard) this instance.
@@ -820,7 +820,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param rkey the registry key.
* @param status the error code status.
* @return TRUE if the call successfully unregistered the factory.
* @return true if the call successfully unregistered the factory.
*/
virtual UBool unregister(URegistryKey rkey, UErrorCode& status);
@@ -833,9 +833,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
virtual void reset(void);
/**
* <p>Return TRUE if the service is in its default state.</p>
* <p>Return true if the service is in its default state.</p>
*
* <p>The default implementation returns TRUE if there are no
* <p>The default implementation returns true if there are no
* factories registered.</p>
*/
virtual UBool isDefault(void) const;
@@ -877,7 +877,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param instanceToAdopt the service instance to adopt.
* @param id the ID to assign to this service instance.
* @param visible if TRUE, the ID will be visible.
* @param visible if true, the ID will be visible.
* @param status the error code status.
* @return an instance of ICUServiceFactory that maps this instance to the provided ID.
*/
@@ -885,7 +885,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* <p>Reinitialize the factory list to its default state. After this call, isDefault()
* must return TRUE.</p>
* must return true.</p>
*
* <p>This issues a serviceChanged notification to registered listeners.</p>
*
@@ -928,7 +928,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* different listeners.</p>
*
* @param l the listener to test.
* @return TRUE if the service accepts the listener.
* @return true if the service accepts the listener.
*/
virtual UBool acceptsListener(const EventListener& l) const;
+1 -1
View File
@@ -105,7 +105,7 @@ public:
protected:
/**
* Subclasses implement this to return TRUE if the listener is
* Subclasses implement this to return true if the listener is
* of the appropriate type.
*/
virtual UBool acceptsListener(const EventListener& l) const = 0;
+2 -2
View File
@@ -90,13 +90,13 @@ public:
int32_t getRefCount() const;
/**
* If noHardReferences() == TRUE then this object has no hard references.
* If noHardReferences() == true then this object has no hard references.
* Must be called only from within the internals of UnifiedCache.
*/
inline UBool noHardReferences() const { return getRefCount() == 0; }
/**
* If hasHardReferences() == TRUE then this object has hard references.
* If hasHardReferences() == true then this object has hard references.
* Must be called only from within the internals of UnifiedCache.
*/
inline UBool hasHardReferences() const { return getRefCount() != 0; }
+2
View File
@@ -263,6 +263,8 @@ UnicodeString SimpleFormatter::getTextWithNoArguments(
sb.append(compiledPattern + i, n);
i += n;
} else if (n < offsetsLength) {
// TODO(ICU-20406): This does not distinguish between "{0}{1}" and "{1}{0}".
// Consider removing this function and replacing it with an iterator interface.
offsets[n] = sb.length();
}
}
+1 -1
View File
@@ -32,7 +32,7 @@
# include <assert.h>
# define U_ASSERT(exp) assert(exp)
#elif U_CPLUSPLUS_VERSION
# define U_ASSERT(exp) void()
# define U_ASSERT(exp) (void)0
#else
# define U_ASSERT(exp)
#endif
+1 -1
View File
@@ -248,7 +248,7 @@ u_charMirror(UChar32 c) {
return ubidi_getMirror(c);
}
U_STABLE UChar32 U_EXPORT2
U_CAPI UChar32 U_EXPORT2
u_getBidiPairedBracket(UChar32 c) {
return ubidi_getPairedBracket(c);
}
+14 -6
View File
@@ -26,6 +26,14 @@
/* miscellaneous definitions ---------------------------------------------- */
// ICU-20853=ICU-20935 Solaris #defines CS and ES in sys/regset.h
#ifdef CS
# undef CS
#endif
#ifdef ES
# undef ES
#endif
typedef uint8_t DirProp;
typedef uint32_t Flags;
@@ -451,26 +459,26 @@ ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAlloc
/* additional macros used by ubidi_open() - always allow allocation */
#define getInitialDirPropsMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
TRUE, (length))
true, (length))
#define getInitialLevelsMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
TRUE, (length))
true, (length))
#define getInitialOpeningsMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \
TRUE, (length)*sizeof(Opening))
true, (length)*sizeof(Opening))
#define getInitialParasMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \
TRUE, (length)*sizeof(Para))
true, (length)*sizeof(Para))
#define getInitialRunsMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
TRUE, (length)*sizeof(Run))
true, (length)*sizeof(Run))
#define getInitialIsolatesMemory(pBiDi, length) \
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \
TRUE, (length)*sizeof(Isolate))
true, (length)*sizeof(Isolate))
#endif
+3 -3
View File
@@ -89,7 +89,7 @@ struct UBiDiTransform {
uint32_t letters; /* letter option for ArabicShaping */
};
U_DRAFT UBiDiTransform* U_EXPORT2
U_CAPI UBiDiTransform* U_EXPORT2
ubiditransform_open(UErrorCode *pErrorCode)
{
UBiDiTransform *pBiDiTransform = NULL;
@@ -102,7 +102,7 @@ ubiditransform_open(UErrorCode *pErrorCode)
return pBiDiTransform;
}
U_DRAFT void U_EXPORT2
U_CAPI void U_EXPORT2
ubiditransform_close(UBiDiTransform *pBiDiTransform)
{
if (pBiDiTransform != NULL) {
@@ -434,7 +434,7 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
return NULL;
}
U_DRAFT uint32_t U_EXPORT2
U_CAPI uint32_t U_EXPORT2
ubiditransform_transform(UBiDiTransform *pBiDiTransform,
const UChar *src, int32_t srcLength,
UChar *dest, int32_t destSize,
+36
View File
@@ -707,6 +707,7 @@ ucase_isCaseSensitive(UChar32 c) {
#define is_r(c) ((c)=='r' || (c)=='R')
#define is_t(c) ((c)=='t' || (c)=='T')
#define is_u(c) ((c)=='u' || (c)=='U')
#define is_y(c) ((c)=='y' || (c)=='Y')
#define is_z(c) ((c)=='z' || (c)=='Z')
/* separator? */
@@ -804,6 +805,18 @@ ucase_getCaseLocale(const char *locale) {
return UCASE_LOC_DUTCH;
}
}
} else if(c=='h') {
/* hy or hye? *not* hyw */
c=*locale++;
if(is_y(c)) {
c=*locale++;
if(is_e(c)) {
c=*locale;
}
if(is_sep(c)) {
return UCASE_LOC_ARMENIAN;
}
}
}
} else {
// uppercase c
@@ -868,6 +881,18 @@ ucase_getCaseLocale(const char *locale) {
return UCASE_LOC_DUTCH;
}
}
} else if(c=='H') {
/* hy or hye? *not* hyw */
c=*locale++;
if(is_y(c)) {
c=*locale++;
if(is_e(c)) {
c=*locale;
}
if(is_sep(c)) {
return UCASE_LOC_ARMENIAN;
}
}
}
}
return UCASE_LOC_ROOT;
@@ -1229,6 +1254,17 @@ toUpperOrTitle(UChar32 c,
*/
*pString=nullptr;
return 0; /* remove the dot (continue without output) */
} else if(c==0x0587) {
// See ICU-13416:
// և ligature ech-yiwn
// uppercases to ԵՒ=ech+yiwn by default and in Western Armenian,
// but to ԵՎ=ech+vew in Eastern Armenian.
if(loc==UCASE_LOC_ARMENIAN) {
*pString=upperNotTitle ? u"ԵՎ" : u"Եվ";
} else {
*pString=upperNotTitle ? u"ԵՒ" : u"Եւ";
}
return 2;
} else {
/* no known conditional special case mapping, use a normal mapping */
}
+3 -2
View File
@@ -56,7 +56,8 @@ enum {
UCASE_LOC_TURKISH,
UCASE_LOC_LITHUANIAN,
UCASE_LOC_GREEK,
UCASE_LOC_DUTCH
UCASE_LOC_DUTCH,
UCASE_LOC_ARMENIAN
};
/**
@@ -117,7 +118,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
* the string itself is added as well as part of its code points' closure.
* It must be length>=0.
*
* @return TRUE if the string was found
* @return true if the string was found
*/
U_CFUNC UBool U_EXPORT2
ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa);
+134 -134
View File
@@ -13,7 +13,7 @@
static const UVersionInfo ucase_props_dataVersion={0xd,0,0,0};
static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x70ca,0x6098,0x687,0x172,0,0,0,0,0,0,0,0,0,0,3};
static const int32_t ucase_props_indexes[UCASE_IX_TOP]={0x10,0x70c2,0x6098,0x683,0x172,0,0,0,0,0,0,0,0,0,0,3};
static const uint16_t ucase_props_trieIndex[12356]={
0x336,0x33e,0x346,0x34e,0x35c,0x364,0x36c,0x374,0x37c,0x384,0x38b,0x393,0x39b,0x3a3,0x3ab,0x3b3,
@@ -411,18 +411,18 @@ static const uint16_t ucase_props_trieIndex[12356]={
0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,
0,0,0,0,0,0,4,0,0,4,4,0,0,0,0,0,
0,0x64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,4,0,0,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,
0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,
0x179a,0x179a,0x179a,0x179a,0x179a,0x179a,0,0x179a,0,0,0,0,0,0x179a,0,0,
0x17b9,0x17e9,0x1819,0x1849,0x1879,0x18a9,0x18d9,0x1909,0x1939,0x1969,0x1999,0x19c9,0x19f9,0x1a29,0x1a59,0x1a89,
0x1ab9,0x1ae9,0x1b19,0x1b49,0x1b79,0x1ba9,0x1bd9,0x1c09,0x1c39,0x1c69,0x1c99,0x1cc9,0x1cf9,0x1d29,0x1d59,0x1d89,
0x1db9,0x1de9,0x1e19,0x1e49,0x1e79,0x1ea9,0x1ed9,0x1f09,0x1f39,0x1f69,0x1f99,0,4,0x1fc9,0x1ff9,0x2029,
0,4,0,0,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,
0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,
0x175a,0x175a,0x175a,0x175a,0x175a,0x175a,0,0x175a,0,0,0,0,0,0x175a,0,0,
0x1779,0x17a9,0x17d9,0x1809,0x1839,0x1869,0x1899,0x18c9,0x18f9,0x1929,0x1959,0x1989,0x19b9,0x19e9,0x1a19,0x1a49,
0x1a79,0x1aa9,0x1ad9,0x1b09,0x1b39,0x1b69,0x1b99,0x1bc9,0x1bf9,0x1c29,0x1c59,0x1c89,0x1cb9,0x1ce9,0x1d19,0x1d49,
0x1d79,0x1da9,0x1dd9,0x1e09,0x1e39,0x1e69,0x1e99,0x1ec9,0x1ef9,0x1f29,0x1f59,0,4,0x1f89,0x1fb9,0x1fe9,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0x44,0x44,0x44,
0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,
0x207a,0x207a,0x207a,0x207a,0x207a,0x207a,0,0,0x2099,0x20c9,0x20f9,0x2129,0x2159,0x2189,0,0,
0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,
0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,0x205a,
0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,
0x203a,0x203a,0x203a,0x203a,0x203a,0x203a,0,0,0x2059,0x2089,0x20b9,0x20e9,0x2119,0x2149,0,0,
0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,
0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,0x201a,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,4,4,0x64,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,4,
@@ -458,9 +458,9 @@ static const uint16_t ucase_props_trieIndex[12356]={
0,0,0,0,4,4,4,4,4,4,4,4,0,0,4,0x64,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,
0x21b9,0x21e9,0x2219,0x2249,0x2279,0x22c9,0x2319,0x2349,0x2379,0,0,0,0,0,0,0,
0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,
0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0x23aa,0,0,0x23aa,0x23aa,0x23aa,
0x2179,0x21a9,0x21d9,0x2209,0x2239,0x2289,0x22d9,0x2309,0x2339,0,0,0,0,0,0,0,
0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,
0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0x236a,0,0,0x236a,0x236a,0x236a,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x44,0x44,0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0x44,0x64,0x64,0x64,0x64,
0x44,0,0x64,0x64,0x64,0x64,0x64,0x64,0x64,0,0,0,0,0x64,0,0,
@@ -470,10 +470,10 @@ static const uint16_t ucase_props_trieIndex[12356]={
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,0x25,5,5,5,5,5,5,5,5,1,1,1,1,1,
1,1,1,1,1,1,1,1,5,0x23c9,1,1,1,0x23e9,1,1,
1,1,1,1,1,1,1,1,5,0x2389,1,1,1,0x23a9,1,1,
5,5,5,5,0x25,5,5,5,0x25,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x2409,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,0x23c9,1,
1,1,1,1,1,1,0x21,1,1,1,1,5,5,5,5,5,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0x44,0x44,0x64,0x64,0x64,0x64,0,0x44,0x64,0x64,0x44,0x64,
@@ -481,27 +481,27 @@ static const uint16_t ucase_props_trieIndex[12356]={
0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x242a,0x2469,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x23ea,0x2429,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x24a9,0x2529,0x25a9,0x2629,0x26a9,0x2729,1,1,0x275a,1,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x2469,0x24e9,0x2569,0x25e9,0x2669,0x26e9,1,1,0x271a,1,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xffb1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x411,0x411,0x411,0x411,
0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411,
0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x411,0x411,0x411,0x411,
0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411,
0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x411,0x411,0x411,0x411,
0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x27a9,0x411,0x2829,0x411,
0x28d9,0x411,0x2989,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411,
0x411,0x411,0,0,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0,0,0x2769,0x411,0x27e9,0x411,
0x2899,0x411,0x2949,0x411,0,0xfc12,0,0xfc12,0,0xfc12,0,0xfc12,0x411,0x411,0x411,0x411,
0x411,0x411,0x411,0x411,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0xfc12,0x2511,0x2511,0x2b11,0x2b11,
0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x2a39,0x2aa9,0x2b19,0x2b89,
0x2bf9,0x2c69,0x2cd9,0x2d49,0x2dbb,0x2e2b,0x2e9b,0x2f0b,0x2f7b,0x2feb,0x305b,0x30cb,0x3139,0x31a9,0x3219,0x3289,
0x32f9,0x3369,0x33d9,0x3449,0x34bb,0x352b,0x359b,0x360b,0x367b,0x36eb,0x375b,0x37cb,0x3839,0x38a9,0x3919,0x3989,
0x39f9,0x3a69,0x3ad9,0x3b49,0x3bbb,0x3c2b,0x3c9b,0x3d0b,0x3d7b,0x3deb,0x3e5b,0x3ecb,0x411,0x411,0x3f39,0x3fb9,
0x4029,0,0x40a9,0x4129,0xfc12,0xfc12,0xdb12,0xdb12,0x41db,4,0x4249,4,4,4,0x4299,0x4319,
0x4389,0,0x4409,0x4489,0xd512,0xd512,0xd512,0xd512,0x453b,4,4,4,0x411,0x411,0x45a9,0x4659,
0,0,0x4729,0x47a9,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4859,0x4909,
0x49d9,0x391,0x4a59,0x4ad9,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b89,0x4c09,
0x4c79,0,0x4cf9,0x4d79,0xc012,0xc012,0xc112,0xc112,0x4e2b,4,4,0,0,0,0,0,
0x2b11,0x2b11,0x3211,0x3211,0x4011,0x4011,0x3811,0x3811,0x3f11,0x3f11,0,0,0x29f9,0x2a69,0x2ad9,0x2b49,
0x2bb9,0x2c29,0x2c99,0x2d09,0x2d7b,0x2deb,0x2e5b,0x2ecb,0x2f3b,0x2fab,0x301b,0x308b,0x30f9,0x3169,0x31d9,0x3249,
0x32b9,0x3329,0x3399,0x3409,0x347b,0x34eb,0x355b,0x35cb,0x363b,0x36ab,0x371b,0x378b,0x37f9,0x3869,0x38d9,0x3949,
0x39b9,0x3a29,0x3a99,0x3b09,0x3b7b,0x3beb,0x3c5b,0x3ccb,0x3d3b,0x3dab,0x3e1b,0x3e8b,0x411,0x411,0x3ef9,0x3f79,
0x3fe9,0,0x4069,0x40e9,0xfc12,0xfc12,0xdb12,0xdb12,0x419b,4,0x4209,4,4,4,0x4259,0x42d9,
0x4349,0,0x43c9,0x4449,0xd512,0xd512,0xd512,0xd512,0x44fb,4,4,4,0x411,0x411,0x4569,0x4619,
0,0,0x46e9,0x4769,0xfc12,0xfc12,0xce12,0xce12,0,4,4,4,0x411,0x411,0x4819,0x48c9,
0x4999,0x391,0x4a19,0x4a99,0xfc12,0xfc12,0xc812,0xc812,0xfc92,4,4,4,0,0,0x4b49,0x4bc9,
0x4c39,0,0x4cb9,0x4d39,0xc012,0xc012,0xc112,0xc112,0x4deb,4,4,0,0,0,0,0,
0,0,0,0,0,0,0,4,4,4,4,4,0,0,0,0,
0,0,0,0,4,4,0,0,0,0,0,0,4,0,0,4,
0,0,4,4,4,4,4,0,0,0,0,0,0,0,0,0,
@@ -515,8 +515,8 @@ static const uint16_t ucase_props_trieIndex[12356]={
0x64,0x44,0x64,0x64,0x64,0x64,0x64,0x64,0x44,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,
0,0,1,2,2,2,1,1,2,2,2,1,0,2,0,0,
0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e9a,0,
2,0,0x4eda,0x4f1a,2,2,0,1,2,2,0xe12,2,1,0,0,0,
0,2,2,2,2,2,0,0,0,0,0,0,2,0,0x4e5a,0,
2,0,0x4e9a,0x4eda,2,2,0,1,2,2,0xe12,2,1,0,0,0,
0,1,0,0,1,1,2,2,0,0,0,0,0,2,1,1,
0x21,0x21,0,0,0,0,0xf211,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0x812,0x812,0x812,0x812,0x812,0x812,0x812,0x812,
@@ -531,14 +531,14 @@ static const uint16_t ucase_props_trieIndex[12356]={
0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,
0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0x1812,0,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,
0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,
0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0,0x92,0xff91,0x4f5a,0x4f7a,0x4f9a,0x4fb9,0x4fd9,0x92,
0xff91,0x92,0xff91,0x92,0xff91,0x4ffa,0x501a,0x503a,0x505a,1,0x92,0xff91,1,0x92,0xff91,1,
1,1,1,1,0x25,5,0x507a,0x507a,0x92,0xff91,0x92,0xff91,1,0,0,0,
0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0xe811,0,0x92,0xff91,0x4f1a,0x4f3a,0x4f5a,0x4f79,0x4f99,0x92,
0xff91,0x92,0xff91,0x92,0xff91,0x4fba,0x4fda,0x4ffa,0x501a,1,0x92,0xff91,1,0x92,0xff91,1,
1,1,1,1,0x25,5,0x503a,0x503a,0x92,0xff91,0x92,0xff91,1,0,0,0,
0,0,0,0x92,0xff91,0x92,0xff91,0x44,0x44,0x44,0x92,0xff91,0,0,0,0,
0,0,0,0,0,0,0,0,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,
0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,
0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0x5099,0,0x5099,0,0,0,0,
0,0x5099,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,
0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,
0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0x5059,0,0x5059,0,0,0,0,
0,0x5059,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0x64,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,
@@ -552,7 +552,7 @@ static const uint16_t ucase_props_trieIndex[12356]={
0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x50ba,0x50f9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x507a,0x50b9,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0x44,
4,4,4,0,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0,4,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
@@ -564,11 +564,11 @@ static const uint16_t ucase_props_trieIndex[12356]={
4,4,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
1,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,5,1,1,1,1,1,1,1,1,0x92,0xff91,0x92,
0xff91,0x513a,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92,
0xff91,0x515a,1,0,0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x517a,0x519a,0x51ba,0x51da,0x517a,1,0x51fa,0x521a,0x523a,0x525a,
0xff91,0x50fa,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,4,4,4,0x92,
0xff91,0x511a,1,0,0x92,0xff91,0x92,0xff91,0x1811,1,0x92,0xff91,0x92,0xff91,0x92,0xff91,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x513a,0x515a,0x517a,0x519a,0x513a,1,0x51ba,0x51da,0x51fa,0x521a,
0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0x92,0xff91,0,0,0x92,0xff91,
0xe812,0x527a,0x529a,0x92,0xff91,0x92,0xff91,0,0,0,0,0,0,0,0,0,
0xe812,0x523a,0x525a,0x92,0xff91,0x92,0xff91,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0x92,0xff91,0,
5,5,1,0,0,0,0,0,0,0,4,0,0,0,0x64,0,
0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -597,17 +597,17 @@ static const uint16_t ucase_props_trieIndex[12356]={
0,0,0,0,4,4,0,0,0,0,0,4,4,0,0x64,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,0x52b9,1,1,1,1,1,1,1,4,5,5,5,5,
1,1,1,0x5279,1,1,1,1,1,1,1,4,5,5,5,5,
1,1,1,1,1,1,1,1,1,4,4,4,0,0,0,0,
0x52d9,0x5309,0x5339,0x5369,0x5399,0x53c9,0x53f9,0x5429,0x5459,0x5489,0x54b9,0x54e9,0x5519,0x5549,0x5579,0x55a9,
0x5bd9,0x5c09,0x5c39,0x5c69,0x5c99,0x5cc9,0x5cf9,0x5d29,0x5d59,0x5d89,0x5db9,0x5de9,0x5e19,0x5e49,0x5e79,0x5ea9,
0x5ed9,0x5f09,0x5f39,0x5f69,0x5f99,0x5fc9,0x5ff9,0x6029,0x6059,0x6089,0x60b9,0x60e9,0x6119,0x6149,0x6179,0x61a9,
0x55d9,0x5609,0x5639,0x5669,0x5699,0x56c9,0x56f9,0x5729,0x5759,0x5789,0x57b9,0x57e9,0x5819,0x5849,0x5879,0x58a9,
0x58d9,0x5909,0x5939,0x5969,0x5999,0x59c9,0x59f9,0x5a29,0x5a59,0x5a89,0x5ab9,0x5ae9,0x5b19,0x5b49,0x5b79,0x5ba9,
0x5299,0x52c9,0x52f9,0x5329,0x5359,0x5389,0x53b9,0x53e9,0x5419,0x5449,0x5479,0x54a9,0x54d9,0x5509,0x5539,0x5569,
0x5b99,0x5bc9,0x5bf9,0x5c29,0x5c59,0x5c89,0x5cb9,0x5ce9,0x5d19,0x5d49,0x5d79,0x5da9,0x5dd9,0x5e09,0x5e39,0x5e69,
0x5e99,0x5ec9,0x5ef9,0x5f29,0x5f59,0x5f89,0x5fb9,0x5fe9,0x6019,0x6049,0x6079,0x60a9,0x60d9,0x6109,0x6139,0x6169,
0x5599,0x55c9,0x55f9,0x5629,0x5659,0x5689,0x56b9,0x56e9,0x5719,0x5749,0x5779,0x57a9,0x57d9,0x5809,0x5839,0x5869,
0x5899,0x58c9,0x58f9,0x5929,0x5959,0x5989,0x59b9,0x59e9,0x5a19,0x5a49,0x5a79,0x5aa9,0x5ad9,0x5b09,0x5b39,0x5b69,
0,0,0,0,0,4,0,0,4,0,0,0,0,0x64,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0x61d9,0x6259,0x62d9,0x6359,0x6409,0x64b9,0x6559,0,0,0,0,0,0,0,0,0,
0,0,0,0x65f9,0x6679,0x66f9,0x6779,0x67f9,0,0,0,0,0,0,0x64,0,
0x6199,0x6219,0x6299,0x6319,0x63c9,0x6479,0x6519,0,0,0,0,0,0,0,0,0,
0,0,0,0x65b9,0x6639,0x66b9,0x6739,0x67b9,0,0,0,0,0,0,0x64,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
4,4,4,4,0,0,0,4,0,0,0,0,0,0,0,0,
@@ -791,7 +791,7 @@ static const uint16_t ucase_props_trieIndex[12356]={
0,0,0,0
};
static const uint16_t ucase_props_exceptions[1671]={
static const uint16_t ucase_props_exceptions[1667]={
0xc850,0x20,2,0x130,0x131,0x4810,0x20,0x841,0x6b,1,0x212a,0x841,0x73,1,0x17f,0x5c50,
0x20,2,0x130,0x131,0x844,0x4b,1,0x212a,0x844,0x53,1,0x17f,0x806,0x3bc,0x39c,0x841,
0xe5,1,0x212b,0x8c0,1,0x2220,0x73,0x73,0x53,0x53,0x53,0x73,0x1e9e,0x844,0xc5,1,
@@ -815,88 +815,88 @@ static const uint16_t ucase_props_exceptions[1671]={
0x43e,1,0x1c82,0x841,0x441,1,0x1c83,0x841,0x442,2,0x1c84,0x1c85,0x841,0x44a,1,0x1c86,
0x844,0x412,1,0x1c80,0x844,0x414,1,0x1c81,0x844,0x41e,1,0x1c82,0x844,0x421,1,0x1c83,
0x844,0x422,2,0x1c84,0x1c85,0x844,0x42a,1,0x1c86,0x841,0x463,1,0x1c87,0x844,0x462,1,
0x1c87,0x880,0x2220,0x565,0x582,0x535,0x552,0x535,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91,
0x10d1,0x80c,0x1c92,0x10d2,0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6,
0x80c,0x1c97,0x10d7,0x80c,0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c,
0x1c9c,0x10dc,0x80c,0x1c9d,0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1,
0x10e1,0x80c,0x1ca2,0x10e2,0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6,
0x80c,0x1ca7,0x10e7,0x80c,0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c,
0x1cac,0x10ec,0x80c,0x1cad,0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1,
0x10f1,0x80c,0x1cb2,0x10f2,0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6,
0x80c,0x1cb7,0x10f7,0x80c,0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c,
0x1cbe,0x10fe,0x80c,0x1cbf,0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806,
0x13f2,0x13f2,0x806,0x13f3,0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434,
0x414,0x806,0x43e,0x41e,0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1,
0x1c84,0x806,0x44a,0x42a,0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6,
0x810,0x8a38,0x841,0x1e61,1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331,
0x48,0x331,0x880,0x2220,0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a,
0x57,0x30a,0x880,0x2220,0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be,
0x41,0x2be,0x806,0x1e61,0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313,
0x3a5,0x313,0x880,0x3330,0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5,
0x313,0x301,0x3a5,0x313,0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342,
0x3a5,0x313,0x342,0x890,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09,
0x399,0x890,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890,
8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220,
0x1f06,0x3b9,0x1f0e,0x399,0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9,
0x1f08,0x399,0xc90,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,
0xc90,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8,
0x220,0x1f05,0x3b9,0x1f0d,0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07,
0x3b9,0x1f0f,0x399,0x890,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29,
0x399,0x890,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890,
8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220,
0x1f26,0x3b9,0x1f2e,0x399,0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9,
0x1f28,0x399,0xc90,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,
0xc90,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8,
0x220,0x1f25,0x3b9,0x1f2d,0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27,
0x3b9,0x1f2f,0x399,0x890,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69,
0x399,0x890,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890,
8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220,
0x1f66,0x3b9,0x1f6e,0x399,0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9,
0x1f68,0x399,0xc90,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,
0xc90,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8,
0x220,0x1f65,0x3b9,0x1f6d,0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67,
0x3b9,0x1f6f,0x399,0x880,0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9,
0x391,0x399,0x880,0x2220,0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342,
0x391,0x342,0x880,0x3330,0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220,
0x3b1,0x3b9,0x391,0x399,0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca,
0x345,0x890,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345,
0x880,0x2220,0x3b7,0x342,0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399,
0x397,0x342,0x345,0xc90,9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399,
0x308,0x300,0x399,0x308,0x300,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,
0x301,0x390,0x880,0x2220,0x3b9,0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399,
0x308,0x342,0x399,0x308,0x342,0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300,
0x8c0,1,0x3330,0x3c5,0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x3b0,0x880,0x2220,0x3c1,
0x313,0x3a1,0x313,0x3a1,0x313,0x880,0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5,
0x308,0x342,0x3a5,0x308,0x342,0x3a5,0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345,
0x890,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880,
0x2220,0x3c9,0x342,0x3a9,0x342,0x3a9,0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9,
0x342,0x345,0xc90,9,0x220,0x3c9,0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1,
0x4b,0xc50,0x2046,1,0xc5,0xc10,0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10,
0x2a1c,0xc10,0x29fd,0xc10,0x2a1f,0xc10,0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844,
0xa64a,1,0x1c88,0xc10,0x8a04,0xc10,0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10,
0xa512,0xc10,0xa52a,0xc10,0xa515,0x810,0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0,
0x806,0x13a1,0x13a1,0x806,0x13a2,0x13a2,0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806,
0x13a6,0x13a6,0x806,0x13a7,0x13a7,0x806,0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab,
0x13ab,0x806,0x13ac,0x13ac,0x806,0x13ad,0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0,
0x806,0x13b1,0x13b1,0x806,0x13b2,0x13b2,0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806,
0x13b6,0x13b6,0x806,0x13b7,0x13b7,0x806,0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb,
0x13bb,0x806,0x13bc,0x13bc,0x806,0x13bd,0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0,
0x806,0x13c1,0x13c1,0x806,0x13c2,0x13c2,0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806,
0x13c6,0x13c6,0x806,0x13c7,0x13c7,0x806,0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb,
0x13cb,0x806,0x13cc,0x13cc,0x806,0x13cd,0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0,
0x806,0x13d1,0x13d1,0x806,0x13d2,0x13d2,0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806,
0x13d6,0x13d6,0x806,0x13d7,0x13d7,0x806,0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db,
0x13db,0x806,0x13dc,0x13dc,0x806,0x13dd,0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0,
0x806,0x13e1,0x13e1,0x806,0x13e2,0x13e2,0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806,
0x13e6,0x13e6,0x806,0x13e7,0x13e7,0x806,0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb,
0x13eb,0x806,0x13ec,0x13ec,0x806,0x13ed,0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66,
0x66,0x46,0x46,0x46,0x66,0x880,0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66,
0x6c,0x46,0x4c,0x46,0x6c,0x880,0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69,
0x880,0x3330,0x66,0x66,0x6c,0x46,0x46,0x4c,0x46,0x66,0x6c,0x8c0,1,0x2220,0x73,0x74,
0x53,0x54,0x53,0x74,0xfb06,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880,
0x2220,0x574,0x576,0x544,0x546,0x544,0x576,0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880,
0x2220,0x574,0x56b,0x544,0x53b,0x544,0x56b,0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880,
0x2220,0x574,0x56d,0x544,0x53d,0x544,0x56d
0x1c87,0x4880,0x20,0x565,0x582,0x810,0x1c60,0x80c,0x1c90,0x10d0,0x80c,0x1c91,0x10d1,0x80c,0x1c92,0x10d2,
0x80c,0x1c93,0x10d3,0x80c,0x1c94,0x10d4,0x80c,0x1c95,0x10d5,0x80c,0x1c96,0x10d6,0x80c,0x1c97,0x10d7,0x80c,
0x1c98,0x10d8,0x80c,0x1c99,0x10d9,0x80c,0x1c9a,0x10da,0x80c,0x1c9b,0x10db,0x80c,0x1c9c,0x10dc,0x80c,0x1c9d,
0x10dd,0x80c,0x1c9e,0x10de,0x80c,0x1c9f,0x10df,0x80c,0x1ca0,0x10e0,0x80c,0x1ca1,0x10e1,0x80c,0x1ca2,0x10e2,
0x80c,0x1ca3,0x10e3,0x80c,0x1ca4,0x10e4,0x80c,0x1ca5,0x10e5,0x80c,0x1ca6,0x10e6,0x80c,0x1ca7,0x10e7,0x80c,
0x1ca8,0x10e8,0x80c,0x1ca9,0x10e9,0x80c,0x1caa,0x10ea,0x80c,0x1cab,0x10eb,0x80c,0x1cac,0x10ec,0x80c,0x1cad,
0x10ed,0x80c,0x1cae,0x10ee,0x80c,0x1caf,0x10ef,0x80c,0x1cb0,0x10f0,0x80c,0x1cb1,0x10f1,0x80c,0x1cb2,0x10f2,
0x80c,0x1cb3,0x10f3,0x80c,0x1cb4,0x10f4,0x80c,0x1cb5,0x10f5,0x80c,0x1cb6,0x10f6,0x80c,0x1cb7,0x10f7,0x80c,
0x1cb8,0x10f8,0x80c,0x1cb9,0x10f9,0x80c,0x1cba,0x10fa,0x80c,0x1cbd,0x10fd,0x80c,0x1cbe,0x10fe,0x80c,0x1cbf,
0x10ff,0xa10,0x97d0,0xa10,8,0x806,0x13f0,0x13f0,0x806,0x13f1,0x13f1,0x806,0x13f2,0x13f2,0x806,0x13f3,
0x13f3,0x806,0x13f4,0x13f4,0x806,0x13f5,0x13f5,0x806,0x432,0x412,0x806,0x434,0x414,0x806,0x43e,0x41e,
0x806,0x441,0x421,0x846,0x442,0x422,1,0x1c85,0x846,0x442,0x422,1,0x1c84,0x806,0x44a,0x42a,
0x806,0x463,0x462,0x806,0xa64b,0xa64a,0xc10,0xbc0,0x810,0x8a04,0x810,0xee6,0x810,0x8a38,0x841,0x1e61,
1,0x1e9b,0x844,0x1e60,1,0x1e9b,0x880,0x2220,0x68,0x331,0x48,0x331,0x48,0x331,0x880,0x2220,
0x74,0x308,0x54,0x308,0x54,0x308,0x880,0x2220,0x77,0x30a,0x57,0x30a,0x57,0x30a,0x880,0x2220,
0x79,0x30a,0x59,0x30a,0x59,0x30a,0x880,0x2220,0x61,0x2be,0x41,0x2be,0x41,0x2be,0x806,0x1e61,
0x1e60,0xc90,0x1dbf,0x20,0x73,0x73,0x880,0x2220,0x3c5,0x313,0x3a5,0x313,0x3a5,0x313,0x880,0x3330,
0x3c5,0x313,0x300,0x3a5,0x313,0x300,0x3a5,0x313,0x300,0x880,0x3330,0x3c5,0x313,0x301,0x3a5,0x313,
0x301,0x3a5,0x313,0x301,0x880,0x3330,0x3c5,0x313,0x342,0x3a5,0x313,0x342,0x3a5,0x313,0x342,0x890,
8,0x220,0x1f00,0x3b9,0x1f08,0x399,0x890,8,0x220,0x1f01,0x3b9,0x1f09,0x399,0x890,8,0x220,
0x1f02,0x3b9,0x1f0a,0x399,0x890,8,0x220,0x1f03,0x3b9,0x1f0b,0x399,0x890,8,0x220,0x1f04,0x3b9,
0x1f0c,0x399,0x890,8,0x220,0x1f05,0x3b9,0x1f0d,0x399,0x890,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,
0x890,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0xc90,8,0x220,0x1f00,0x3b9,0x1f08,0x399,0xc90,8,
0x220,0x1f01,0x3b9,0x1f09,0x399,0xc90,8,0x220,0x1f02,0x3b9,0x1f0a,0x399,0xc90,8,0x220,0x1f03,
0x3b9,0x1f0b,0x399,0xc90,8,0x220,0x1f04,0x3b9,0x1f0c,0x399,0xc90,8,0x220,0x1f05,0x3b9,0x1f0d,
0x399,0xc90,8,0x220,0x1f06,0x3b9,0x1f0e,0x399,0xc90,8,0x220,0x1f07,0x3b9,0x1f0f,0x399,0x890,
8,0x220,0x1f20,0x3b9,0x1f28,0x399,0x890,8,0x220,0x1f21,0x3b9,0x1f29,0x399,0x890,8,0x220,
0x1f22,0x3b9,0x1f2a,0x399,0x890,8,0x220,0x1f23,0x3b9,0x1f2b,0x399,0x890,8,0x220,0x1f24,0x3b9,
0x1f2c,0x399,0x890,8,0x220,0x1f25,0x3b9,0x1f2d,0x399,0x890,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,
0x890,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0xc90,8,0x220,0x1f20,0x3b9,0x1f28,0x399,0xc90,8,
0x220,0x1f21,0x3b9,0x1f29,0x399,0xc90,8,0x220,0x1f22,0x3b9,0x1f2a,0x399,0xc90,8,0x220,0x1f23,
0x3b9,0x1f2b,0x399,0xc90,8,0x220,0x1f24,0x3b9,0x1f2c,0x399,0xc90,8,0x220,0x1f25,0x3b9,0x1f2d,
0x399,0xc90,8,0x220,0x1f26,0x3b9,0x1f2e,0x399,0xc90,8,0x220,0x1f27,0x3b9,0x1f2f,0x399,0x890,
8,0x220,0x1f60,0x3b9,0x1f68,0x399,0x890,8,0x220,0x1f61,0x3b9,0x1f69,0x399,0x890,8,0x220,
0x1f62,0x3b9,0x1f6a,0x399,0x890,8,0x220,0x1f63,0x3b9,0x1f6b,0x399,0x890,8,0x220,0x1f64,0x3b9,
0x1f6c,0x399,0x890,8,0x220,0x1f65,0x3b9,0x1f6d,0x399,0x890,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,
0x890,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0xc90,8,0x220,0x1f60,0x3b9,0x1f68,0x399,0xc90,8,
0x220,0x1f61,0x3b9,0x1f69,0x399,0xc90,8,0x220,0x1f62,0x3b9,0x1f6a,0x399,0xc90,8,0x220,0x1f63,
0x3b9,0x1f6b,0x399,0xc90,8,0x220,0x1f64,0x3b9,0x1f6c,0x399,0xc90,8,0x220,0x1f65,0x3b9,0x1f6d,
0x399,0xc90,8,0x220,0x1f66,0x3b9,0x1f6e,0x399,0xc90,8,0x220,0x1f67,0x3b9,0x1f6f,0x399,0x880,
0x2220,0x1f70,0x3b9,0x1fba,0x399,0x1fba,0x345,0x890,9,0x220,0x3b1,0x3b9,0x391,0x399,0x880,0x2220,
0x3ac,0x3b9,0x386,0x399,0x386,0x345,0x880,0x2220,0x3b1,0x342,0x391,0x342,0x391,0x342,0x880,0x3330,
0x3b1,0x342,0x3b9,0x391,0x342,0x399,0x391,0x342,0x345,0xc90,9,0x220,0x3b1,0x3b9,0x391,0x399,
0x846,0x3b9,0x399,1,0x345,0x880,0x2220,0x1f74,0x3b9,0x1fca,0x399,0x1fca,0x345,0x890,9,0x220,
0x3b7,0x3b9,0x397,0x399,0x880,0x2220,0x3ae,0x3b9,0x389,0x399,0x389,0x345,0x880,0x2220,0x3b7,0x342,
0x397,0x342,0x397,0x342,0x880,0x3330,0x3b7,0x342,0x3b9,0x397,0x342,0x399,0x397,0x342,0x345,0xc90,
9,0x220,0x3b7,0x3b9,0x397,0x399,0x880,0x3330,0x3b9,0x308,0x300,0x399,0x308,0x300,0x399,0x308,
0x300,0x8c0,1,0x3330,0x3b9,0x308,0x301,0x399,0x308,0x301,0x399,0x308,0x301,0x390,0x880,0x2220,
0x3b9,0x342,0x399,0x342,0x399,0x342,0x880,0x3330,0x3b9,0x308,0x342,0x399,0x308,0x342,0x399,0x308,
0x342,0x880,0x3330,0x3c5,0x308,0x300,0x3a5,0x308,0x300,0x3a5,0x308,0x300,0x8c0,1,0x3330,0x3c5,
0x308,0x301,0x3a5,0x308,0x301,0x3a5,0x308,0x301,0x3b0,0x880,0x2220,0x3c1,0x313,0x3a1,0x313,0x3a1,
0x313,0x880,0x2220,0x3c5,0x342,0x3a5,0x342,0x3a5,0x342,0x880,0x3330,0x3c5,0x308,0x342,0x3a5,0x308,
0x342,0x3a5,0x308,0x342,0x880,0x2220,0x1f7c,0x3b9,0x1ffa,0x399,0x1ffa,0x345,0x890,9,0x220,0x3c9,
0x3b9,0x3a9,0x399,0x880,0x2220,0x3ce,0x3b9,0x38f,0x399,0x38f,0x345,0x880,0x2220,0x3c9,0x342,0x3a9,
0x342,0x3a9,0x342,0x880,0x3330,0x3c9,0x342,0x3b9,0x3a9,0x342,0x399,0x3a9,0x342,0x345,0xc90,9,
0x220,0x3c9,0x3b9,0x3a9,0x399,0xc50,0x1d5d,1,0x3a9,0xc50,0x20bf,1,0x4b,0xc50,0x2046,1,
0xc5,0xc10,0x29f7,0xc10,0xee6,0xc10,0x29e7,0xc10,0x2a2b,0xc10,0x2a28,0xc10,0x2a1c,0xc10,0x29fd,0xc10,
0x2a1f,0xc10,0x2a1e,0xc10,0x2a3f,0xc10,0x1c60,0x841,0xa64b,1,0x1c88,0x844,0xa64a,1,0x1c88,0xc10,
0x8a04,0xc10,0xa528,0xc10,0xa544,0xc10,0xa54f,0xc10,0xa54b,0xc10,0xa541,0xc10,0xa512,0xc10,0xa52a,0xc10,
0xa515,0x810,0x3a0,0xc10,0xa543,0xc10,0x8a38,0xc10,0x3a0,0x806,0x13a0,0x13a0,0x806,0x13a1,0x13a1,0x806,
0x13a2,0x13a2,0x806,0x13a3,0x13a3,0x806,0x13a4,0x13a4,0x806,0x13a5,0x13a5,0x806,0x13a6,0x13a6,0x806,0x13a7,
0x13a7,0x806,0x13a8,0x13a8,0x806,0x13a9,0x13a9,0x806,0x13aa,0x13aa,0x806,0x13ab,0x13ab,0x806,0x13ac,0x13ac,
0x806,0x13ad,0x13ad,0x806,0x13ae,0x13ae,0x806,0x13af,0x13af,0x806,0x13b0,0x13b0,0x806,0x13b1,0x13b1,0x806,
0x13b2,0x13b2,0x806,0x13b3,0x13b3,0x806,0x13b4,0x13b4,0x806,0x13b5,0x13b5,0x806,0x13b6,0x13b6,0x806,0x13b7,
0x13b7,0x806,0x13b8,0x13b8,0x806,0x13b9,0x13b9,0x806,0x13ba,0x13ba,0x806,0x13bb,0x13bb,0x806,0x13bc,0x13bc,
0x806,0x13bd,0x13bd,0x806,0x13be,0x13be,0x806,0x13bf,0x13bf,0x806,0x13c0,0x13c0,0x806,0x13c1,0x13c1,0x806,
0x13c2,0x13c2,0x806,0x13c3,0x13c3,0x806,0x13c4,0x13c4,0x806,0x13c5,0x13c5,0x806,0x13c6,0x13c6,0x806,0x13c7,
0x13c7,0x806,0x13c8,0x13c8,0x806,0x13c9,0x13c9,0x806,0x13ca,0x13ca,0x806,0x13cb,0x13cb,0x806,0x13cc,0x13cc,
0x806,0x13cd,0x13cd,0x806,0x13ce,0x13ce,0x806,0x13cf,0x13cf,0x806,0x13d0,0x13d0,0x806,0x13d1,0x13d1,0x806,
0x13d2,0x13d2,0x806,0x13d3,0x13d3,0x806,0x13d4,0x13d4,0x806,0x13d5,0x13d5,0x806,0x13d6,0x13d6,0x806,0x13d7,
0x13d7,0x806,0x13d8,0x13d8,0x806,0x13d9,0x13d9,0x806,0x13da,0x13da,0x806,0x13db,0x13db,0x806,0x13dc,0x13dc,
0x806,0x13dd,0x13dd,0x806,0x13de,0x13de,0x806,0x13df,0x13df,0x806,0x13e0,0x13e0,0x806,0x13e1,0x13e1,0x806,
0x13e2,0x13e2,0x806,0x13e3,0x13e3,0x806,0x13e4,0x13e4,0x806,0x13e5,0x13e5,0x806,0x13e6,0x13e6,0x806,0x13e7,
0x13e7,0x806,0x13e8,0x13e8,0x806,0x13e9,0x13e9,0x806,0x13ea,0x13ea,0x806,0x13eb,0x13eb,0x806,0x13ec,0x13ec,
0x806,0x13ed,0x13ed,0x806,0x13ee,0x13ee,0x806,0x13ef,0x13ef,0x880,0x2220,0x66,0x66,0x46,0x46,0x46,
0x66,0x880,0x2220,0x66,0x69,0x46,0x49,0x46,0x69,0x880,0x2220,0x66,0x6c,0x46,0x4c,0x46,
0x6c,0x880,0x3330,0x66,0x66,0x69,0x46,0x46,0x49,0x46,0x66,0x69,0x880,0x3330,0x66,0x66,
0x6c,0x46,0x46,0x4c,0x46,0x66,0x6c,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,
0xfb06,0x8c0,1,0x2220,0x73,0x74,0x53,0x54,0x53,0x74,0xfb05,0x880,0x2220,0x574,0x576,0x544,
0x546,0x544,0x576,0x880,0x2220,0x574,0x565,0x544,0x535,0x544,0x565,0x880,0x2220,0x574,0x56b,0x544,
0x53b,0x544,0x56b,0x880,0x2220,0x57e,0x576,0x54e,0x546,0x54e,0x576,0x880,0x2220,0x574,0x56d,0x544,
0x53d,0x544,0x56d
};
static const uint16_t ucase_props_unfold[370]={
+4 -4
View File
@@ -68,15 +68,15 @@ class BreakIterator; // unicode/brkiter.h
class ByteSink;
class Locale; // unicode/locid.h
/** Returns TRUE if the options are valid. Otherwise FALSE, and sets an error. */
/** Returns true if the options are valid. Otherwise false, and sets an error. */
inline UBool ustrcase_checkTitleAdjustmentOptions(uint32_t options, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return FALSE; }
if (U_FAILURE(errorCode)) { return false; }
if ((options & U_TITLECASE_ADJUSTMENT_MASK) == U_TITLECASE_ADJUSTMENT_MASK) {
// Both options together.
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
return false;
}
return TRUE;
return true;
}
inline UBool ustrcase_isLNS(UChar32 c) {
+2
View File
@@ -38,6 +38,8 @@ typedef enum ECleanupCommonType {
UCLN_COMMON_SERVICE,
UCLN_COMMON_LOCALE_KEY_TYPE,
UCLN_COMMON_LOCALE,
UCLN_COMMON_LOCALE_ALIAS,
UCLN_COMMON_LOCALE_KNOWN_CANONICALIZED,
UCLN_COMMON_LOCALE_AVAILABLE,
UCLN_COMMON_LIKELY_SUBTAGS,
UCLN_COMMON_LOCALE_DISTANCE,
+3 -3
View File
@@ -78,7 +78,7 @@
* Use the ANSI C 'atexit' function. Note that this mechanism does not
* guarantee the order of cleanup relative to other users of ICU!
*/
static UBool gAutoCleanRegistered = FALSE;
static UBool gAutoCleanRegistered = false;
static void ucln_atexit_handler()
{
@@ -88,7 +88,7 @@ static void ucln_atexit_handler()
static void ucln_registerAutomaticCleanup()
{
if(!gAutoCleanRegistered) {
gAutoCleanRegistered = TRUE;
gAutoCleanRegistered = true;
atexit(&ucln_atexit_handler);
}
}
@@ -135,7 +135,7 @@ U_CAPI void U_EXPORT2 UCLN_FINI ()
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
BOOL status = TRUE;
BOOL status = true;
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
+1 -1
View File
@@ -262,7 +262,7 @@ static UBool U_CALLCONV ucnv_cleanup(void) {
}
U_CAPI void U_EXPORT2
ucnv_enableCleanup() {
ucnv_enableCleanup(void) {
ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
}
+7 -7
View File
@@ -101,8 +101,8 @@ struct UConverterSharedData {
const UConverterStaticData *staticData; /* pointer to the static (non changing) data. */
UBool sharedDataCached; /* TRUE: shared data is in cache, don't destroy on ucnv_close() if 0 ref. FALSE: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
/** If FALSE, then referenceCounter is not used. Must not change after initialization. */
UBool sharedDataCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
/** If false, then referenceCounter is not used. Must not change after initialization. */
UBool isReferenceCounted;
const UConverterImpl *impl; /* vtable-style struct of mostly function pointers */
@@ -128,7 +128,7 @@ struct UConverterSharedData {
#define UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(pStaticData, pImpl) \
{ \
sizeof(UConverterSharedData), ~((uint32_t)0), \
NULL, pStaticData, FALSE, FALSE, pImpl, \
NULL, pStaticData, false, false, pImpl, \
0, UCNV_MBCS_TABLE_INITIALIZER \
}
@@ -181,9 +181,9 @@ struct UConverter {
uint32_t options; /* options flags from UConverterOpen, may contain additional bits */
UBool sharedDataIsCached; /* TRUE: shared data is in cache, don't destroy on ucnv_close() if 0 ref. FALSE: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
UBool isCopyLocal; /* TRUE if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
UBool isExtraLocal; /* TRUE if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
UBool sharedDataIsCached; /* true: shared data is in cache, don't destroy on ucnv_close() if 0 ref. false: shared data isn't in the cache, do attempt to clean it up if the ref is 0 */
UBool isCopyLocal; /* true if UConverter is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
UBool isExtraLocal; /* true if extraInfo is not owned and not released in ucnv_close() (stack-allocated, safeClone(), etc.) */
UBool useFallback;
int8_t toULength; /* number of bytes in toUBytes */
@@ -289,7 +289,7 @@ ucnv_swap(const UDataSwapper *ds,
UErrorCode *pErrorCode);
U_CAPI void U_EXPORT2
ucnv_enableCleanup();
ucnv_enableCleanup(void);
#endif
+3 -3
View File
@@ -59,7 +59,7 @@ typedef struct {
} UConverterLoadArgs;
#define UCNV_LOAD_ARGS_INITIALIZER \
{ (int32_t)sizeof(UConverterLoadArgs), 0, FALSE, FALSE, 0, 0, NULL, NULL, NULL }
{ (int32_t)sizeof(UConverterLoadArgs), 0, false, false, 0, 0, NULL, NULL, NULL }
typedef void (*UConverterLoad) (UConverterSharedData *sharedData,
UConverterLoadArgs *pArgs,
@@ -267,8 +267,8 @@ extern const UConverterSharedData
U_CDECL_END
/** Always use fallbacks from codepage to Unicode */
#define TO_U_USE_FALLBACK(useFallback) TRUE
#define UCNV_TO_U_USE_FALLBACK(cnv) TRUE
#define TO_U_USE_FALLBACK(useFallback) true
#define UCNV_TO_U_USE_FALLBACK(cnv) true
/** Use fallbacks from Unicode to codepage when cnv->useFallback or for private-use code points */
#define IS_PRIVATE_USE(c) ((uint32_t)((c)-0xe000)<0x1900 || (uint32_t)((c)-0xf0000)<0x20000)
+2 -2
View File
@@ -707,9 +707,9 @@ ucnv_UTF8FromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
// Do not go back into the bytes that will be read for finishing a partial
// sequence from the previous buffer.
int32_t length=count-toULimit;
int32_t length=count-toULength;
U8_TRUNCATE_IF_INCOMPLETE(source, 0, length);
count=toULimit+length;
count=toULength+length;
}
if(c!=0) {
+1 -1
View File
@@ -420,7 +420,7 @@ typedef struct UConverterMBCSTable {
NULL, \
0, \
0, 0, \
FALSE, \
false, \
0, \
\
/* roundtrips */ \
+1 -1
View File
@@ -31,7 +31,7 @@
* Does the data look like a collation binary?
* @internal
*/
U_INTERNAL UBool U_EXPORT2
U_CAPI UBool U_EXPORT2
ucol_looksLikeCollationBinary(const UDataSwapper *ds,
const void *inData, int32_t length);
+20 -7
View File
@@ -91,6 +91,8 @@ static const char VAR_DELIM = '_';
// Tag for localized display names (symbols) of currencies
static const char CURRENCIES[] = "Currencies";
static const char CURRENCIES_NARROW[] = "Currencies%narrow";
static const char CURRENCIES_FORMAL[] = "Currencies%formal";
static const char CURRENCIES_VARIANT[] = "Currencies%variant";
static const char CURRENCYPLURALS[] = "CurrencyPlurals";
// ISO codes mapping table
@@ -649,7 +651,7 @@ ucurr_getName(const UChar* currency,
}
int32_t choice = (int32_t) nameStyle;
if (choice < 0 || choice > 2) {
if (choice < 0 || choice > 4) {
*ec = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -684,9 +686,22 @@ ucurr_getName(const UChar* currency,
ec2 = U_ZERO_ERROR;
LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
if (nameStyle == UCURR_NARROW_SYMBOL_NAME) {
if (nameStyle == UCURR_NARROW_SYMBOL_NAME || nameStyle == UCURR_FORMAL_SYMBOL_NAME || nameStyle == UCURR_VARIANT_SYMBOL_NAME) {
CharString key;
key.append(CURRENCIES_NARROW, ec2);
switch (nameStyle) {
case UCURR_NARROW_SYMBOL_NAME:
key.append(CURRENCIES_NARROW, ec2);
break;
case UCURR_FORMAL_SYMBOL_NAME:
key.append(CURRENCIES_FORMAL, ec2);
break;
case UCURR_VARIANT_SYMBOL_NAME:
key.append(CURRENCIES_VARIANT, ec2);
break;
default:
*ec = U_UNSUPPORTED_ERROR;
return 0;
}
key.append("/", ec2);
key.append(buf, ec2);
s = ures_getStringByKeyWithFallback(rb.getAlias(), key.data(), len, &ec2);
@@ -1610,7 +1625,7 @@ ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec) {
return ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec);
}
U_DRAFT int32_t U_EXPORT2
U_CAPI int32_t U_EXPORT2
ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) {
int32_t fracDigits = 0;
if (U_SUCCESS(*ec)) {
@@ -1633,7 +1648,7 @@ ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec) {
return ucurr_getRoundingIncrementForUsage(currency, UCURR_USAGE_STANDARD, ec);
}
U_DRAFT double U_EXPORT2
U_CAPI double U_EXPORT2
ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) {
double result = 0.0;
@@ -2259,7 +2274,6 @@ ucurr_countCurrencies(const char* locale,
// local variables
UErrorCode localStatus = U_ZERO_ERROR;
char id[ULOC_FULLNAME_CAPACITY];
uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus);
// get country or country_variant in `id'
idForLocale(locale, id, sizeof(id), ec);
@@ -2375,7 +2389,6 @@ ucurr_forLocaleAndDate(const char* locale,
// local variables
UErrorCode localStatus = U_ZERO_ERROR;
char id[ULOC_FULLNAME_CAPACITY];
resLen = uloc_getKeywordValue(locale, "currency", id, ULOC_FULLNAME_CAPACITY, &localStatus);
// get country or country_variant in `id'
idForLocale(locale, id, sizeof(id), ec);
+1 -1
View File
@@ -46,7 +46,7 @@ typedef union UElement UElement;
* An element-equality (boolean) comparison function.
* @param e1 An element (object or integer)
* @param e2 An element (object or integer)
* @return TRUE if the two elements are equal.
* @return true if the two elements are equal.
*/
typedef UBool U_CALLCONV UElementsAreEqual(const UElement e1, const UElement e2);
+2 -2
View File
@@ -579,7 +579,7 @@ uprv_ebcdicToLowercaseAscii(char c) {
return (char)lowercaseAsciiFromEbcdic[(uint8_t)c];
}
U_INTERNAL uint8_t* U_EXPORT2
U_CAPI uint8_t* U_EXPORT2
uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
{
uint8_t *orig_dst = dst;
@@ -600,7 +600,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
return orig_dst;
}
U_INTERNAL uint8_t* U_EXPORT2
U_CAPI uint8_t* U_EXPORT2
uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
{
uint8_t *orig_dst = dst;
+9 -9
View File
@@ -33,11 +33,11 @@
*
* @param s Input string pointer.
* @param length Length of the string, can be -1 if NUL-terminated.
* @return TRUE if s contains only invariant characters.
* @return true if s contains only invariant characters.
*
* @internal (ICU 2.8)
*/
U_INTERNAL UBool U_EXPORT2
U_CAPI UBool U_EXPORT2
uprv_isInvariantString(const char *s, int32_t length);
/**
@@ -46,11 +46,11 @@ uprv_isInvariantString(const char *s, int32_t length);
*
* @param s Input string pointer.
* @param length Length of the string, can be -1 if NUL-terminated.
* @return TRUE if s contains only invariant characters.
* @return true if s contains only invariant characters.
*
* @internal (ICU 2.8)
*/
U_INTERNAL UBool U_EXPORT2
U_CAPI UBool U_EXPORT2
uprv_isInvariantUString(const UChar *s, int32_t length);
/**
@@ -141,7 +141,7 @@ uprv_isEbcdicAtSign(char c);
* Compare two EBCDIC invariant-character strings in ASCII order.
* @internal
*/
U_INTERNAL int32_t U_EXPORT2
U_CAPI int32_t U_EXPORT2
uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
/**
@@ -161,7 +161,7 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
* Converts an EBCDIC invariant character to ASCII.
* @internal
*/
U_INTERNAL char U_EXPORT2
U_CAPI char U_EXPORT2
uprv_ebcdicToAscii(char c);
/**
@@ -181,7 +181,7 @@ uprv_ebcdicToAscii(char c);
* Converts an EBCDIC invariant character to lowercase ASCII.
* @internal
*/
U_INTERNAL char U_EXPORT2
U_CAPI char U_EXPORT2
uprv_ebcdicToLowercaseAscii(char c);
/**
@@ -202,7 +202,7 @@ uprv_ebcdicToLowercaseAscii(char c);
* @internal
* @see uprv_strncpy
*/
U_INTERNAL uint8_t* U_EXPORT2
U_CAPI uint8_t* U_EXPORT2
uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
@@ -211,7 +211,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
* @internal
* @see uprv_strncpy
*/
U_INTERNAL uint8_t* U_EXPORT2
U_CAPI uint8_t* U_EXPORT2
uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
+123 -186
View File
@@ -50,9 +50,6 @@
#include "uassert.h"
#include "charstr.h"
#include <algorithm>
#include <stdio.h> /* for sprintf */
U_NAMESPACE_USE
/* ### Declarations **************************************************/
@@ -60,12 +57,6 @@ U_NAMESPACE_USE
/* Locale stuff from locid.cpp */
U_CFUNC void locale_set_default(const char *id);
U_CFUNC const char *locale_get_default(void);
U_CFUNC int32_t
locale_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
UBool valuesToo,
UErrorCode *status);
/* ### Data tables **************************************************/
@@ -601,12 +592,12 @@ compareKeywordStructs(const void * /*context*/, const void *left, const void *ri
return uprv_strcmp(leftString, rightString);
}
static void
_getKeywords(const char *localeID,
char prev,
ByteSink& sink,
UBool valuesToo,
UErrorCode *status)
U_CFUNC void
ulocimp_getKeywords(const char *localeID,
char prev,
ByteSink& sink,
UBool valuesToo,
UErrorCode *status)
{
KeywordStruct keywordList[ULOC_MAX_NO_KEYWORDS];
@@ -722,18 +713,18 @@ _getKeywords(const char *localeID,
}
}
U_CFUNC int32_t
locale_getKeywords(const char *localeID,
char prev,
char *keywords, int32_t keywordCapacity,
UBool valuesToo,
UErrorCode *status) {
U_CAPI int32_t U_EXPORT2
uloc_getKeywordValue(const char* localeID,
const char* keywordName,
char* buffer, int32_t bufferCapacity,
UErrorCode* status)
{
if (U_FAILURE(*status)) {
return 0;
}
CheckedArrayByteSink sink(keywords, keywordCapacity);
_getKeywords(localeID, prev, sink, valuesToo, status);
CheckedArrayByteSink sink(buffer, bufferCapacity);
ulocimp_getKeywordValue(localeID, keywordName, sink, status);
int32_t reslen = sink.NumberOfBytesAppended();
@@ -744,26 +735,22 @@ locale_getKeywords(const char *localeID,
if (sink.Overflowed()) {
*status = U_BUFFER_OVERFLOW_ERROR;
} else {
u_terminateChars(keywords, keywordCapacity, reslen, status);
u_terminateChars(buffer, bufferCapacity, reslen, status);
}
return reslen;
}
U_CAPI int32_t U_EXPORT2
uloc_getKeywordValue(const char* localeID,
const char* keywordName,
char* buffer, int32_t bufferCapacity,
UErrorCode* status)
U_CAPI void U_EXPORT2
ulocimp_getKeywordValue(const char* localeID,
const char* keywordName,
icu::ByteSink& sink,
UErrorCode* status)
{
if (buffer != nullptr) {
buffer[0] = '\0';
}
const char* startSearchHere = NULL;
const char* nextSeparator = NULL;
char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
char localeKeywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
int32_t result = 0;
if(status && U_SUCCESS(*status) && localeID) {
char tempBuffer[ULOC_FULLNAME_CAPACITY];
@@ -771,12 +758,12 @@ uloc_getKeywordValue(const char* localeID,
if (keywordName == NULL || keywordName[0] == 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
return;
}
locale_canonKeywordName(keywordNameBuffer, keywordName, status);
if(U_FAILURE(*status)) {
return 0;
return;
}
if (_hasBCP47Extension(localeID)) {
@@ -788,7 +775,7 @@ uloc_getKeywordValue(const char* localeID,
startSearchHere = locale_getKeywordsStart(tmpLocaleID);
if(startSearchHere == NULL) {
/* no keywords, return at once */
return 0;
return;
}
/* find the first keyword */
@@ -800,7 +787,7 @@ uloc_getKeywordValue(const char* localeID,
nextSeparator = uprv_strchr(startSearchHere, '=');
if(!nextSeparator) {
*status = U_ILLEGAL_ARGUMENT_ERROR; /* key must have =value */
return 0;
return;
}
/* strip leading & trailing spaces (TC decided to tolerate these) */
while(*startSearchHere == ' ') {
@@ -814,20 +801,20 @@ uloc_getKeywordValue(const char* localeID,
/* copy & normalize keyName from locale */
if (startSearchHere == keyValueTail) {
*status = U_ILLEGAL_ARGUMENT_ERROR; /* empty keyword name in passed-in locale */
return 0;
return;
}
keyValueLen = 0;
while (startSearchHere < keyValueTail) {
if (!UPRV_ISALPHANUM(*startSearchHere)) {
*status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed keyword name */
return 0;
return;
}
if (keyValueLen < ULOC_KEYWORD_BUFFER_LEN - 1) {
localeKeywordNameBuffer[keyValueLen++] = uprv_tolower(*startSearchHere++);
} else {
/* keyword name too long for internal buffer */
*status = U_INTERNAL_PROGRAM_ERROR;
return 0;
return;
}
}
localeKeywordNameBuffer[keyValueLen] = 0; /* terminate */
@@ -848,28 +835,20 @@ uloc_getKeywordValue(const char* localeID,
/* Now copy the value, but check well-formedness */
if (nextSeparator == keyValueTail) {
*status = U_ILLEGAL_ARGUMENT_ERROR; /* empty key value name in passed-in locale */
return 0;
return;
}
keyValueLen = 0;
while (nextSeparator < keyValueTail) {
if (!UPRV_ISALPHANUM(*nextSeparator) && !UPRV_OK_VALUE_PUNCTUATION(*nextSeparator)) {
*status = U_ILLEGAL_ARGUMENT_ERROR; /* malformed key value */
return 0;
}
if (keyValueLen < bufferCapacity) {
/* Should we lowercase value to return here? Tests expect as-is. */
buffer[keyValueLen++] = *nextSeparator++;
} else { /* keep advancing so we return correct length in case of overflow */
keyValueLen++;
nextSeparator++;
return;
}
/* Should we lowercase value to return here? Tests expect as-is. */
sink.Append(nextSeparator++, 1);
}
result = u_terminateChars(buffer, bufferCapacity, keyValueLen, status);
return result;
return;
}
}
}
return 0;
}
U_CAPI int32_t U_EXPORT2
@@ -892,7 +871,6 @@ uloc_setKeywordValue(const char* keywordName,
char* startSearchHere = NULL;
char* keywordStart = NULL;
CharString updatedKeysAndValues;
int32_t updatedKeysAndValuesLen;
UBool handledInputKeyAndValue = FALSE;
char keyValuePrefix = '@';
@@ -1072,18 +1050,10 @@ uloc_setKeywordValue(const char* keywordName,
return bufLen;
}
updatedKeysAndValuesLen = updatedKeysAndValues.length();
/* needLen = length of the part before '@' + length of updated key-value part including '@' */
needLen = (int32_t)(startSearchHere - buffer) + updatedKeysAndValuesLen;
if(needLen >= bufferCapacity) {
*status = U_BUFFER_OVERFLOW_ERROR;
return needLen; /* no change */
}
if (updatedKeysAndValuesLen > 0) {
uprv_strncpy(startSearchHere, updatedKeysAndValues.data(), updatedKeysAndValuesLen);
}
buffer[needLen]=0;
return needLen;
// needLen = length of the part before '@'
needLen = (int32_t)(startSearchHere - buffer);
return needLen + updatedKeysAndValues.extract(
startSearchHere, bufferCapacity - needLen, *status);
}
/* ### ID parsing implementation **************************************************/
@@ -1148,7 +1118,7 @@ uloc_getCurrentLanguageID(const char* oldID){
*
* TODO try to use this in Locale
*/
static CharString
CharString U_EXPORT2
ulocimp_getLanguage(const char *localeID,
const char **pEnd,
UErrorCode &status) {
@@ -1193,21 +1163,7 @@ ulocimp_getLanguage(const char *localeID,
return result;
}
U_CFUNC int32_t
ulocimp_getLanguage(const char *localeID,
char *language, int32_t languageCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getLanguage(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(language, result.data(), std::min(reslen, languageCapacity));
return reslen;
}
static CharString
CharString U_EXPORT2
ulocimp_getScript(const char *localeID,
const char **pEnd,
UErrorCode &status) {
@@ -1241,21 +1197,7 @@ ulocimp_getScript(const char *localeID,
return result;
}
U_CFUNC int32_t
ulocimp_getScript(const char *localeID,
char *script, int32_t scriptCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getScript(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(script, result.data(), std::min(reslen, scriptCapacity));
return reslen;
}
static CharString
CharString U_EXPORT2
ulocimp_getCountry(const char *localeID,
const char **pEnd,
UErrorCode &status) {
@@ -1290,29 +1232,15 @@ ulocimp_getCountry(const char *localeID,
return result;
}
U_CFUNC int32_t
ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd) {
ErrorCode status;
CharString result = ulocimp_getCountry(localeID, pEnd, status);
if (status.isFailure()) {
return 0;
}
int32_t reslen = result.length();
uprv_memcpy(country, result.data(), std::min(reslen, countryCapacity));
return reslen;
}
/**
* @param needSeparator if true, then add leading '_' if any variants
* are added to 'variant'
*/
static void
_getVariantEx(const char *localeID,
char prev,
ByteSink& sink,
UBool needSeparator) {
_getVariant(const char *localeID,
char prev,
ByteSink& sink,
UBool needSeparator) {
UBool hasVariant = FALSE;
/* get one or more variant tags and separate them with '_' */
@@ -1353,23 +1281,6 @@ _getVariantEx(const char *localeID,
}
}
static int32_t
_getVariantEx(const char *localeID,
char prev,
char *variant, int32_t variantCapacity,
UBool needSeparator) {
CheckedArrayByteSink sink(variant, variantCapacity);
_getVariantEx(localeID, prev, sink, needSeparator);
return sink.NumberOfBytesAppended();
}
static int32_t
_getVariant(const char *localeID,
char prev,
char *variant, int32_t variantCapacity) {
return _getVariantEx(localeID, prev, variant, variantCapacity, FALSE);
}
/* Keyword enumeration */
typedef struct UKeywordsContext {
@@ -1466,9 +1377,6 @@ U_CAPI UEnumeration* U_EXPORT2
uloc_openKeywords(const char* localeID,
UErrorCode* status)
{
int32_t i=0;
char keywords[256];
int32_t keywordsCapacity = 256;
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* tmpLocaleID;
@@ -1486,34 +1394,42 @@ uloc_openKeywords(const char* localeID,
}
/* Skip the language */
ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID);
ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *status);
if (U_FAILURE(*status)) {
return 0;
}
if(_isIDSeparator(*tmpLocaleID)) {
const char *scriptID;
/* Skip the script if available */
ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID);
ulocimp_getScript(tmpLocaleID+1, &scriptID, *status);
if (U_FAILURE(*status)) {
return 0;
}
if(scriptID != tmpLocaleID+1) {
/* Found optional script */
tmpLocaleID = scriptID;
}
/* Skip the Country */
if (_isIDSeparator(*tmpLocaleID)) {
ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &tmpLocaleID);
if(_isIDSeparator(*tmpLocaleID)) {
_getVariant(tmpLocaleID+1, *tmpLocaleID, NULL, 0);
ulocimp_getCountry(tmpLocaleID+1, &tmpLocaleID, *status);
if (U_FAILURE(*status)) {
return 0;
}
}
}
/* keywords are located after '@' */
if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) {
i=locale_getKeywords(tmpLocaleID+1, '@', keywords, keywordsCapacity, FALSE, status);
}
if(i) {
return uloc_openKeywordList(keywords, i, status);
} else {
return NULL;
CharString keywords;
CharStringByteSink sink(&keywords);
ulocimp_getKeywords(tmpLocaleID+1, '@', sink, FALSE, status);
if (U_FAILURE(*status)) {
return NULL;
}
return uloc_openKeywordList(keywords.data(), keywords.length(), status);
}
return NULL;
}
@@ -1605,7 +1521,7 @@ _canonicalize(const char* localeID,
variantSize = -tag.length();
{
CharStringByteSink s(&tag);
_getVariantEx(tmpLocaleID+1, *tmpLocaleID, s, FALSE);
_getVariant(tmpLocaleID+1, *tmpLocaleID, s, FALSE);
}
variantSize += tag.length();
if (variantSize > 0) {
@@ -1667,7 +1583,7 @@ _canonicalize(const char* localeID,
int32_t posixVariantSize = -tag.length();
{
CharStringByteSink s(&tag);
_getVariantEx(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0));
_getVariant(tmpLocaleID+1, '@', s, (UBool)(variantSize > 0));
}
posixVariantSize += tag.length();
if (posixVariantSize > 0) {
@@ -1696,7 +1612,7 @@ _canonicalize(const char* localeID,
(!separatorIndicator || separatorIndicator > keywordAssign)) {
sink.Append("@", 1);
++fieldCount;
_getKeywords(tmpLocaleID+1, '@', sink, TRUE, err);
ulocimp_getKeywords(tmpLocaleID+1, '@', sink, TRUE, err);
}
}
}
@@ -1745,7 +1661,6 @@ uloc_getLanguage(const char* localeID,
UErrorCode* err)
{
/* uloc_getLanguage will return a 2 character iso-639 code if one exists. *CWB*/
int32_t i=0;
if (err==NULL || U_FAILURE(*err)) {
return 0;
@@ -1755,8 +1670,7 @@ uloc_getLanguage(const char* localeID,
localeID=uloc_getDefault();
}
i=ulocimp_getLanguage(localeID, language, languageCapacity, NULL);
return u_terminateChars(language, languageCapacity, i, err);
return ulocimp_getLanguage(localeID, NULL, *err).extract(language, languageCapacity, *err);
}
U_CAPI int32_t U_EXPORT2
@@ -1765,8 +1679,6 @@ uloc_getScript(const char* localeID,
int32_t scriptCapacity,
UErrorCode* err)
{
int32_t i=0;
if(err==NULL || U_FAILURE(*err)) {
return 0;
}
@@ -1776,11 +1688,15 @@ uloc_getScript(const char* localeID,
}
/* skip the language */
ulocimp_getLanguage(localeID, NULL, 0, &localeID);
if(_isIDSeparator(*localeID)) {
i=ulocimp_getScript(localeID+1, script, scriptCapacity, NULL);
ulocimp_getLanguage(localeID, &localeID, *err);
if (U_FAILURE(*err)) {
return 0;
}
return u_terminateChars(script, scriptCapacity, i, err);
if(_isIDSeparator(*localeID)) {
return ulocimp_getScript(localeID+1, NULL, *err).extract(script, scriptCapacity, *err);
}
return u_terminateChars(script, scriptCapacity, 0, err);
}
U_CAPI int32_t U_EXPORT2
@@ -1789,8 +1705,6 @@ uloc_getCountry(const char* localeID,
int32_t countryCapacity,
UErrorCode* err)
{
int32_t i=0;
if(err==NULL || U_FAILURE(*err)) {
return 0;
}
@@ -1800,20 +1714,27 @@ uloc_getCountry(const char* localeID,
}
/* Skip the language */
ulocimp_getLanguage(localeID, NULL, 0, &localeID);
ulocimp_getLanguage(localeID, &localeID, *err);
if (U_FAILURE(*err)) {
return 0;
}
if(_isIDSeparator(*localeID)) {
const char *scriptID;
/* Skip the script if available */
ulocimp_getScript(localeID+1, NULL, 0, &scriptID);
ulocimp_getScript(localeID+1, &scriptID, *err);
if (U_FAILURE(*err)) {
return 0;
}
if(scriptID != localeID+1) {
/* Found optional script */
localeID = scriptID;
}
if(_isIDSeparator(*localeID)) {
i=ulocimp_getCountry(localeID+1, country, countryCapacity, NULL);
return ulocimp_getCountry(localeID+1, NULL, *err).extract(country, countryCapacity, *err);
}
}
return u_terminateChars(country, countryCapacity, i, err);
return u_terminateChars(country, countryCapacity, 0, err);
}
U_CAPI int32_t U_EXPORT2
@@ -1840,11 +1761,18 @@ uloc_getVariant(const char* localeID,
}
/* Skip the language */
ulocimp_getLanguage(tmpLocaleID, NULL, 0, &tmpLocaleID);
ulocimp_getLanguage(tmpLocaleID, &tmpLocaleID, *err);
if (U_FAILURE(*err)) {
return 0;
}
if(_isIDSeparator(*tmpLocaleID)) {
const char *scriptID;
/* Skip the script if available */
ulocimp_getScript(tmpLocaleID+1, NULL, 0, &scriptID);
ulocimp_getScript(tmpLocaleID+1, &scriptID, *err);
if (U_FAILURE(*err)) {
return 0;
}
if(scriptID != tmpLocaleID+1) {
/* Found optional script */
tmpLocaleID = scriptID;
@@ -1852,7 +1780,10 @@ uloc_getVariant(const char* localeID,
/* Skip the Country */
if (_isIDSeparator(*tmpLocaleID)) {
const char *cntryID;
ulocimp_getCountry(tmpLocaleID+1, NULL, 0, &cntryID);
ulocimp_getCountry(tmpLocaleID+1, &cntryID, *err);
if (U_FAILURE(*err)) {
return 0;
}
if (cntryID != tmpLocaleID+1) {
/* Found optional country */
tmpLocaleID = cntryID;
@@ -1862,18 +1793,24 @@ uloc_getVariant(const char* localeID,
if (tmpLocaleID != cntryID && _isIDSeparator(tmpLocaleID[1])) {
tmpLocaleID++;
}
i=_getVariant(tmpLocaleID+1, *tmpLocaleID, variant, variantCapacity);
CheckedArrayByteSink sink(variant, variantCapacity);
_getVariant(tmpLocaleID+1, *tmpLocaleID, sink, FALSE);
i = sink.NumberOfBytesAppended();
if (U_FAILURE(*err)) {
return i;
}
if (sink.Overflowed()) {
*err = U_BUFFER_OVERFLOW_ERROR;
return i;
}
}
}
}
/* removed by weiv. We don't want to handle POSIX variants anymore. Use canonicalization function */
/* if we do not have a variant tag yet then try a POSIX variant after '@' */
/*
if(!haveVariant && (localeID=uprv_strrchr(localeID, '@'))!=NULL) {
i=_getVariant(localeID+1, '@', variant, variantCapacity);
}
*/
return u_terminateChars(variant, variantCapacity, i, err);
}
@@ -1905,7 +1842,7 @@ uloc_getName(const char* localeID,
return reslen;
}
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_getName(const char* localeID,
ByteSink& sink,
UErrorCode* err)
@@ -1941,7 +1878,7 @@ uloc_getBaseName(const char* localeID,
return reslen;
}
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_getBaseName(const char* localeID,
ByteSink& sink,
UErrorCode* err)
@@ -1977,7 +1914,7 @@ uloc_canonicalize(const char* localeID,
return reslen;
}
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_canonicalize(const char* localeID,
ByteSink& sink,
UErrorCode* err)
@@ -2058,22 +1995,22 @@ uloc_getLCID(const char* localeID)
// uprv_convertToLCID does not support keywords other than collation.
// Remove all keywords except collation.
int32_t len;
char collVal[ULOC_KEYWORDS_CAPACITY];
char tmpLocaleID[ULOC_FULLNAME_CAPACITY];
len = uloc_getKeywordValue(localeID, "collation", collVal,
UPRV_LENGTHOF(collVal) - 1, &status);
if (U_SUCCESS(status) && len > 0) {
collVal[len] = 0;
CharString collVal;
{
CharStringByteSink sink(&collVal);
ulocimp_getKeywordValue(localeID, "collation", sink, &status);
}
if (U_SUCCESS(status) && !collVal.isEmpty()) {
len = uloc_getBaseName(localeID, tmpLocaleID,
UPRV_LENGTHOF(tmpLocaleID) - 1, &status);
if (U_SUCCESS(status) && len > 0) {
tmpLocaleID[len] = 0;
len = uloc_setKeywordValue("collation", collVal, tmpLocaleID,
len = uloc_setKeywordValue("collation", collVal.data(), tmpLocaleID,
UPRV_LENGTHOF(tmpLocaleID) - len - 1, &status);
if (U_SUCCESS(status) && len > 0) {
+52 -85
View File
@@ -15,6 +15,7 @@
#include "unicode/uenum.h"
#include "unicode/uloc.h"
#include "ustr_imp.h"
#include "bytesinkutil.h"
#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
@@ -53,7 +54,7 @@ typedef struct ULanguageTag {
VariantListEntry *variants;
ExtensionListEntry *extensions;
const char *privateuse;
const char *grandfathered;
const char *legacy;
} ULanguageTag;
#define MINLEN 2
@@ -85,8 +86,9 @@ static const char LOCALE_TYPE_YES[] = "yes";
Updated on 2018-09-12 from
https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
This table has 2 parts. The parts for Grandfathered tags is generated by the
following scripts from the IANA language tag registry.
This table has 2 parts. The part for
legacy language tags (marked as “Type: grandfathered” in BCP 47)
is generated by the following scripts from the IANA language tag registry.
curl https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry |\
egrep -A 7 'Type: grandfathered' | \
@@ -100,8 +102,8 @@ static const char LOCALE_TYPE_YES[] = "yes";
values. They may have to be removed for the strict BCP 47 compliance.
*/
static const char* const GRANDFATHERED[] = {
/* grandfathered preferred */
static const char* const LEGACY[] = {
/* legacy preferred */
"art-lojban", "jbo",
"en-gb-oed", "en-gb-oxendict",
"i-ami", "ami",
@@ -124,7 +126,7 @@ static const char* const GRANDFATHERED[] = {
"zh-min-nan", "nan",
"zh-xiang", "hsn",
// Grandfathered tags with no preferred value in the IANA
// Legacy tags with no preferred value in the IANA
// registry. Kept for now for the backward compatibility
// because ICU has mapped them this way.
"cel-gaulish", "xtg-x-cel-gaulish",
@@ -346,7 +348,7 @@ ultag_getPrivateUse(const ULanguageTag* langtag);
#if 0
static const char*
ultag_getGrandfathered(const ULanguageTag* langtag);
ultag_getLegacy(const ULanguageTag* langtag);
#endif
U_NAMESPACE_BEGIN
@@ -986,7 +988,7 @@ _initializeULanguageTag(ULanguageTag* langtag) {
langtag->variants = NULL;
langtag->extensions = NULL;
langtag->grandfathered = EMPTY;
langtag->legacy = EMPTY;
langtag->privateuse = EMPTY;
}
@@ -1268,35 +1270,17 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
UBool isBcpUExt;
while (TRUE) {
icu::CharString buf;
key = uenum_next(keywordEnum.getAlias(), NULL, status);
if (key == NULL) {
break;
}
char* buffer;
int32_t resultCapacity = ULOC_KEYWORD_AND_VALUES_CAPACITY;
for (;;) {
buffer = buf.getAppendBuffer(
/*minCapacity=*/resultCapacity,
/*desiredCapacityHint=*/resultCapacity,
resultCapacity,
tmpStatus);
if (U_FAILURE(tmpStatus)) {
break;
}
len = uloc_getKeywordValue(
localeID, key, buffer, resultCapacity, &tmpStatus);
if (tmpStatus != U_BUFFER_OVERFLOW_ERROR) {
break;
}
resultCapacity = len;
tmpStatus = U_ZERO_ERROR;
icu::CharString buf;
{
icu::CharStringByteSink sink(&buf);
ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus);
}
len = buf.length();
if (U_FAILURE(tmpStatus)) {
if (tmpStatus == U_MEMORY_ALLOCATION_ERROR) {
@@ -1312,11 +1296,6 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
continue;
}
buf.append(buffer, len, tmpStatus);
if (tmpStatus == U_STRING_NOT_TERMINATED_WARNING) {
tmpStatus = U_ZERO_ERROR; // Terminators provided by CharString.
}
keylen = (int32_t)uprv_strlen(key);
isBcpUExt = (keylen > 1);
@@ -1395,32 +1374,18 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
no known mapping. This implementation normalizes the
value to lower case
*/
icu::CharString* extBuf = extBufPool.create();
icu::CharString* extBuf = extBufPool.create(buf, tmpStatus);
if (extBuf == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
int32_t bcpValueLen = static_cast<int32_t>(uprv_strlen(bcpValue));
int32_t resultCapacity;
char* pExtBuf = extBuf->getAppendBuffer(
/*minCapacity=*/bcpValueLen,
/*desiredCapacityHint=*/bcpValueLen,
resultCapacity,
tmpStatus);
if (U_FAILURE(tmpStatus)) {
*status = tmpStatus;
break;
}
uprv_strcpy(pExtBuf, bcpValue);
T_CString_toLowerCase(pExtBuf);
extBuf->append(pExtBuf, bcpValueLen, tmpStatus);
if (U_FAILURE(tmpStatus)) {
*status = tmpStatus;
break;
}
T_CString_toLowerCase(extBuf->data());
bcpValue = extBuf->data();
}
} else {
@@ -2023,11 +1988,12 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool
#define PRIV 0x0080
/**
* Ticket #12705 - Visual Studio 2015 Update 3 contains a new code optimizer which has problems optimizing
* this function. (See https://blogs.msdn.microsoft.com/vcblog/2016/05/04/new-code-optimizer/ )
* As a workaround, we will turn off optimization just for this function on VS2015 Update 3 and above.
* Ticket #12705 - The optimizer in Visual Studio 2015 Update 3 has problems optimizing this function.
* As a work-around, optimization is disabled for this function on VS2015 and VS2017.
* This work-around should be removed once the following versions of Visual Studio are no
* longer supported: All versions of VS2015/VS2017, and versions of VS2019 below 16.4.
*/
#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924)
#pragma optimize( "", off )
#endif
@@ -2042,7 +2008,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
char *pExtValueSubtag, *pExtValueSubtagEnd;
int32_t i;
UBool privateuseVar = FALSE;
int32_t grandfatheredLen = 0;
int32_t legacyLen = 0;
if (parsedLen != NULL) {
*parsedLen = 0;
@@ -2082,25 +2048,25 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
size_t parsedLenDelta = 0;
// Grandfathered tag will be consider together. Grandfathered tag with intervening
// Legacy tag will be consider together. Legacy tag with intervening
// script and region such as art-DE-lojban or art-Latn-lojban won't be
// matched.
/* check if the tag is grandfathered */
for (i = 0; i < UPRV_LENGTHOF(GRANDFATHERED); i += 2) {
int32_t checkGrandfatheredLen = static_cast<int32_t>(uprv_strlen(GRANDFATHERED[i]));
if (tagLen < checkGrandfatheredLen) {
/* check if the tag is legacy */
for (i = 0; i < UPRV_LENGTHOF(LEGACY); i += 2) {
int32_t checkLegacyLen = static_cast<int32_t>(uprv_strlen(LEGACY[i]));
if (tagLen < checkLegacyLen) {
continue;
}
if (tagLen > checkGrandfatheredLen && tagBuf[checkGrandfatheredLen] != '-') {
if (tagLen > checkLegacyLen && tagBuf[checkLegacyLen] != '-') {
// make sure next char is '-'.
continue;
}
if (uprv_strnicmp(GRANDFATHERED[i], tagBuf, checkGrandfatheredLen) == 0) {
if (uprv_strnicmp(LEGACY[i], tagBuf, checkLegacyLen) == 0) {
int32_t newTagLength;
grandfatheredLen = checkGrandfatheredLen; /* back up for output parsedLen */
int32_t replacementLen = static_cast<int32_t>(uprv_strlen(GRANDFATHERED[i+1]));
newTagLength = replacementLen + tagLen - checkGrandfatheredLen;
legacyLen = checkLegacyLen; /* back up for output parsedLen */
int32_t replacementLen = static_cast<int32_t>(uprv_strlen(LEGACY[i+1]));
newTagLength = replacementLen + tagLen - checkLegacyLen;
if (tagLen < newTagLength) {
uprv_free(tagBuf);
tagBuf = (char*)uprv_malloc(newTagLength + 1);
@@ -2111,16 +2077,16 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
t->buf = tagBuf;
tagLen = newTagLength;
}
parsedLenDelta = checkGrandfatheredLen - replacementLen;
uprv_strcpy(t->buf, GRANDFATHERED[i + 1]);
if (checkGrandfatheredLen != tagLen) {
uprv_strcpy(t->buf + replacementLen, tag + checkGrandfatheredLen);
parsedLenDelta = checkLegacyLen - replacementLen;
uprv_strcpy(t->buf, LEGACY[i + 1]);
if (checkLegacyLen != tagLen) {
uprv_strcpy(t->buf + replacementLen, tag + checkLegacyLen);
}
break;
}
}
if (grandfatheredLen == 0) {
if (legacyLen == 0) {
for (i = 0; i < UPRV_LENGTHOF(REDUNDANT); i += 2) {
const char* redundantTag = REDUNDANT[i];
size_t redundantTagLen = uprv_strlen(redundantTag);
@@ -2440,10 +2406,8 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
return t.orphan();
}
/**
* Ticket #12705 - Turn optimization back on.
*/
#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
// Ticket #12705 - Turn optimization back on.
#if defined(_MSC_VER) && (_MSC_VER >= 1900) && (_MSC_VER < 1924)
#pragma optimize( "", on )
#endif
@@ -2608,8 +2572,8 @@ ultag_getPrivateUse(const ULanguageTag* langtag) {
#if 0
static const char*
ultag_getGrandfathered(const ULanguageTag* langtag) {
return langtag->grandfathered;
ultag_getLegacy(const ULanguageTag* langtag) {
return langtag->legacy;
}
#endif
@@ -2720,14 +2684,17 @@ ulocimp_toLanguageTag(const char* localeID,
key = uenum_next(kwdEnum.getAlias(), &len, &tmpStatus);
if (len == 1 && *key == PRIVATEUSE) {
char buf[ULOC_KEYWORD_AND_VALUES_CAPACITY];
buf[0] = PRIVATEUSE;
buf[1] = SEP;
len = uloc_getKeywordValue(localeID, key, &buf[2], sizeof(buf) - 2, &tmpStatus);
icu::CharString buf;
{
icu::CharStringByteSink sink(&buf);
ulocimp_getKeywordValue(localeID, key, sink, &tmpStatus);
}
if (U_SUCCESS(tmpStatus)) {
if (ultag_isPrivateuseValueSubtags(&buf[2], len)) {
if (ultag_isPrivateuseValueSubtags(buf.data(), buf.length())) {
/* return private use only tag */
sink.Append(buf, len + 2);
static const char PREFIX[] = { PRIVATEUSE, SEP };
sink.Append(PREFIX, sizeof(PREFIX));
sink.Append(buf.data(), buf.length());
done = TRUE;
} else if (strict) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
+51 -26
View File
@@ -13,6 +13,8 @@
#include "unicode/bytestream.h"
#include "unicode/uloc.h"
#include "charstr.h"
/**
* Create an iterator over the specified keywords list
* @param keywordList double-null terminated list. Will be copied.
@@ -38,7 +40,7 @@ uloc_getTableStringWithFallback(
int32_t *pLength,
UErrorCode *pErrorCode);
/*returns TRUE if a is an ID separator FALSE otherwise*/
/*returns true if a is an ID separator false otherwise*/
#define _isIDSeparator(a) (a == '_' || a == '-')
U_CFUNC const char*
@@ -47,42 +49,55 @@ uloc_getCurrentCountryID(const char* oldID);
U_CFUNC const char*
uloc_getCurrentLanguageID(const char* oldID);
U_CFUNC int32_t
U_CFUNC void
ulocimp_getKeywords(const char *localeID,
char prev,
icu::ByteSink& sink,
UBool valuesToo,
UErrorCode *status);
icu::CharString U_EXPORT2
ulocimp_getLanguage(const char *localeID,
char *language, int32_t languageCapacity,
const char **pEnd);
const char **pEnd,
UErrorCode &status);
U_CFUNC int32_t
icu::CharString U_EXPORT2
ulocimp_getScript(const char *localeID,
char *script, int32_t scriptCapacity,
const char **pEnd);
const char **pEnd,
UErrorCode &status);
U_CFUNC int32_t
icu::CharString U_EXPORT2
ulocimp_getCountry(const char *localeID,
char *country, int32_t countryCapacity,
const char **pEnd);
const char **pEnd,
UErrorCode &status);
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_getName(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_getBaseName(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_canonicalize(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
U_CAPI void U_EXPORT2
ulocimp_getKeywordValue(const char* localeID,
const char* keywordName,
icu::ByteSink& sink,
UErrorCode* status);
/**
* Writes a well-formed language tag for this locale ID.
*
* **Note**: When `strict` is FALSE, any locale fields which do not satisfy the
* **Note**: When `strict` is false, any locale fields which do not satisfy the
* BCP47 syntax requirement will be omitted from the result. When `strict` is
* TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale
* true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the `err` if any locale
* fields do not satisfy the BCP47 syntax requirement.
*
* @param localeID the input locale ID
@@ -96,7 +111,7 @@ ulocimp_canonicalize(const char* localeID,
*
* @internal ICU 64
*/
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_toLanguageTag(const char* localeID,
icu::ByteSink& sink,
UBool strict,
@@ -107,13 +122,17 @@ ulocimp_toLanguageTag(const char* localeID,
* If the specified language tag contains any ill-formed subtags,
* the first such subtag and all following subtags are ignored.
* <p>
* This implements the 'Language-Tag' production of BCP47, and so
* supports grandfathered (regular and irregular) as well as private
* use language tags. Private use tags are represented as 'x-whatever',
* and grandfathered tags are converted to their canonical replacements
* where they exist. Note that a few grandfathered tags have no modern
* replacement, these will be converted using the fallback described in
* This implements the 'Language-Tag' production of BCP 47, and so
* supports legacy language tags (marked as “Type: grandfathered” in BCP 47)
* (regular and irregular) as well as private use language tags.
*
* Private use tags are represented as 'x-whatever',
* and legacy tags are converted to their canonical replacements where they exist.
*
* Note that a few legacy tags have no modern replacement;
* these will be converted using the fallback described in
* the first paragraph, so some information might be lost.
*
* @param langtag the input BCP47 language tag.
* @param tagLen the length of langtag, or -1 to call uprv_strlen().
* @param sink the output sink receiving a locale ID for the
@@ -135,7 +154,7 @@ ulocimp_forLanguageTag(const char* langtag,
* Get the region to use for supplemental data lookup. Uses
* (1) any region specified by locale tag "rg"; if none then
* (2) any unicode_region_tag in the locale ID; if none then
* (3) if inferRegion is TRUE, the region suggested by
* (3) if inferRegion is true, the region suggested by
* getLikelySubtags on the localeID.
* If no region is found, returns length 0.
*
@@ -143,7 +162,7 @@ ulocimp_forLanguageTag(const char* langtag,
* The complete locale ID (with keywords) from which
* to get the region to use for supplemental data.
* @param inferRegion
* If TRUE, will try to infer region from localeID if
* If true, will try to infer region from localeID if
* no other region is found.
* @param region
* Buffer in which to put the region ID found; should
@@ -189,7 +208,7 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
* or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
* @internal ICU 64
*/
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_addLikelySubtags(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
@@ -223,7 +242,7 @@ ulocimp_addLikelySubtags(const char* localeID,
* or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
* @internal ICU 64
*/
U_STABLE void U_EXPORT2
U_CAPI void U_EXPORT2
ulocimp_minimizeSubtags(const char* localeID,
icu::ByteSink& sink,
UErrorCode* err);
@@ -279,4 +298,10 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i
U_CFUNC const char*
ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType);
/* Function for testing purpose */
U_CAPI const char* const* ulocimp_getKnownCanonicalizedLocaleForTest(int32_t* length);
// Return true if the value is already canonicalized.
U_CAPI bool ulocimp_isCanonicalizedLocaleForTest(const char* localeName);
#endif
+2 -2
View File
@@ -262,13 +262,13 @@ private:
* the global ICU mutex. Recursive locks are an error
* and may cause a deadlock on some platforms.
*/
U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex);
U_CAPI void U_EXPORT2 umtx_lock(UMutex* mutex);
/* Unlock a mutex.
* @param mutex The given mutex to be unlocked. Pass NULL to specify
* the global ICU mutex.
*/
U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex);
U_CAPI void U_EXPORT2 umtx_unlock (UMutex* mutex);
U_NAMESPACE_END
+10 -10
View File
@@ -45,7 +45,7 @@ class UnicodeString;
*
* The methods do not take UErrorCode parameters.
* If an error occurs (e.g., out-of-memory),
* in addition to returning FALSE from failing operations,
* in addition to returning false from failing operations,
* the implementation must prevent unexpected behavior (e.g., crashes)
* from further calls and should make the error condition available separately
* (e.g., store a UErrorCode, make/keep a UnicodeString bogus).
@@ -62,7 +62,7 @@ public:
/**
* Appends a 16-bit code unit.
* @param c code unit
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendCodeUnit(char16_t c) = 0;
@@ -71,7 +71,7 @@ public:
* Appends a code point.
* The default implementation calls appendCodeUnit(char16_t) once or twice.
* @param c code point 0..0x10ffff
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendCodePoint(UChar32 c);
@@ -81,7 +81,7 @@ public:
* The default implementation calls appendCodeUnit(char16_t) for each code unit.
* @param s string, must not be NULL if length!=0
* @param length string length, or -1 if NUL-terminated
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendString(const char16_t *s, int32_t length);
@@ -90,9 +90,9 @@ public:
* Tells the object that the caller is going to append roughly
* appendCapacity char16_ts. A subclass might use this to pre-allocate
* a larger buffer if necessary.
* The default implementation does nothing. (It always returns TRUE.)
* The default implementation does nothing. (It always returns true.)
* @param appendCapacity estimated number of char16_ts that will be appended
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool reserveAppendCapacity(int32_t appendCapacity);
@@ -171,7 +171,7 @@ public:
/**
* Appends a 16-bit code unit to the string.
* @param c code unit
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendCodeUnit(char16_t c);
@@ -179,7 +179,7 @@ public:
/**
* Appends a code point to the string.
* @param c code point 0..0x10ffff
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendCodePoint(UChar32 c);
@@ -188,7 +188,7 @@ public:
* Appends a string to the UnicodeString.
* @param s string, must not be NULL if length!=0
* @param length string length, or -1 if NUL-terminated
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool appendString(const char16_t *s, int32_t length);
@@ -197,7 +197,7 @@ public:
* Tells the UnicodeString that the caller is going to append roughly
* appendCapacity char16_ts.
* @param appendCapacity estimated number of char16_ts that will be appended
* @return TRUE if the operation succeeded
* @return true if the operation succeeded
* @stable ICU 4.8
*/
virtual UBool reserveAppendCapacity(int32_t appendCapacity);
+2 -2
View File
@@ -564,7 +564,7 @@ public:
* BreakIterator::createXXXInstance to avoid undefined behavior.
* @param key the registry key returned by a previous call to registerInstance
* @param status the in/out status code, no special meanings are assigned
* @return TRUE if the iterator for the key was successfully unregistered
* @return true if the iterator for the key was successfully unregistered
* @stable ICU 2.4
*/
static UBool U_EXPORT2 unregister(URegistryKey key, UErrorCode& status);
@@ -655,7 +655,7 @@ private:
inline UBool BreakIterator::isBufferClone()
{
return FALSE;
return false;
}
#endif /* U_HIDE_DEPRECATED_API */
+2 -2
View File
@@ -197,7 +197,7 @@ public:
* Returns the sink to its original state, without modifying the buffer.
* Useful for reusing both the buffer and the sink for multiple streams.
* Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0
* and Overflowed()=FALSE.
* and Overflowed()=false.
* @return *this
* @stable ICU 4.6
*/
@@ -236,7 +236,7 @@ public:
/**
* Returns true if any bytes were discarded, i.e., if there was an
* attempt to write more than 'capacity' bytes.
* @return TRUE if more than 'capacity' bytes were Append()ed
* @return true if more than 'capacity' bytes were Append()ed
* @stable ICU 4.2
*/
UBool Overflowed() const { return overflowed_; }
+7 -9
View File
@@ -97,14 +97,13 @@ public:
return *this;
}
#ifndef U_HIDE_DRAFT_API
/**
* Returns the state of this trie as a 64-bit integer.
* The state value is never 0.
*
* @return opaque state value
* @see resetToState64
* @draft ICU 65
* @stable ICU 65
*/
uint64_t getState64() const {
return (static_cast<uint64_t>(remainingMatchLength_ + 2) << kState64RemainingShift) |
@@ -123,14 +122,13 @@ public:
* @see getState64
* @see resetToState
* @see reset
* @draft ICU 65
* @stable ICU 65
*/
BytesTrie &resetToState64(uint64_t state) {
remainingMatchLength_ = static_cast<int32_t>(state >> kState64RemainingShift) - 2;
pos_ = bytes_ + (state & kState64PosMask);
return *this;
}
#endif /* U_HIDE_DRAFT_API */
/**
* BytesTrie state object, for saving a trie's current state
@@ -253,16 +251,16 @@ public:
/**
* Determines whether all byte sequences reachable from the current state
* map to the same value.
* @param uniqueValue Receives the unique value, if this function returns TRUE.
* @param uniqueValue Receives the unique value, if this function returns true.
* (output-only)
* @return TRUE if all byte sequences reachable from the current state
* @return true if all byte sequences reachable from the current state
* map to the same value.
* @stable ICU 4.8
*/
inline UBool hasUniqueValue(int32_t &uniqueValue) const {
const uint8_t *pos=pos_;
// Skip the rest of a pending linear-match node.
return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, FALSE, uniqueValue);
return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
}
/**
@@ -321,7 +319,7 @@ public:
Iterator &reset();
/**
* @return TRUE if there are more elements.
* @return true if there are more elements.
* @stable ICU 4.8
*/
UBool hasNext() const;
@@ -337,7 +335,7 @@ public:
* pass the U_SUCCESS() test, or else the function returns
* immediately. Check for U_FAILURE() on output or use with
* function chaining. (See User Guide for details.)
* @return TRUE if there is another element.
* @return true if there is another element.
* @stable ICU 4.8
*/
UBool next(UErrorCode &errorCode);
+5 -4
View File
@@ -101,9 +101,10 @@ public:
* Multiple calls to buildStringPiece() return StringPieces referring to the
* builder's same byte array, without rebuilding.
* If buildStringPiece() is called after build(), the trie will be
* re-serialized into a new array.
* If build() is called after buildStringPiece(), the trie object will become
* the owner of the previously returned array.
* re-serialized into a new array (because build() passes on ownership).
* If build() is called after buildStringPiece(), the trie object returned
* by build() will become the owner of the underlying string for the
* previously returned StringPiece.
* After clear() has been called, a new array will be used as well.
* @param buildOption Build option, see UStringTrieBuildOption.
* @param errorCode Standard ICU error code. Its input value must
@@ -139,7 +140,7 @@ private:
virtual int32_t skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t count) const;
virtual int32_t indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const;
virtual UBool matchNodesCanHaveValues() const { return FALSE; }
virtual UBool matchNodesCanHaveValues() const { return false; }
virtual int32_t getMaxBranchLinearSubNodeLength() const { return BytesTrie::kMaxBranchLinearSubNodeLength; }
virtual int32_t getMinLinearMatch() const { return BytesTrie::kMinLinearMatch; }
+2 -2
View File
@@ -25,11 +25,11 @@
*/
/** Should permutation skip characters with combining class zero
* Should be either TRUE or FALSE. This is a compile time option
* Should be either true or false. This is a compile time option
* @stable ICU 2.4
*/
#ifndef CANITER_SKIP_ZEROES
#define CANITER_SKIP_ZEROES TRUE
#define CANITER_SKIP_ZEROES true
#endif
U_NAMESPACE_BEGIN
+6 -6
View File
@@ -65,7 +65,7 @@ U_NAMESPACE_BEGIN
* check for the end of the iteration. When there are no more
* characters in the text object:
* <ul>
* <li>The hasNext() function returns FALSE.</li>
* <li>The hasNext() function returns false.</li>
* <li>nextPostInc() and next32PostInc() return DONE
* when one attempts to read beyond the end of the text object.</li>
* </ul>
@@ -165,11 +165,11 @@ public:
virtual UChar32 next32PostInc(void) = 0;
/**
* Returns FALSE if there are no more code units or code points
* Returns false if there are no more code units or code points
* at or after the current position in the iteration range.
* This is used with nextPostInc() or next32PostInc() in forward
* iteration.
* @returns FALSE if there are no more code units or code points
* @returns false if there are no more code units or code points
* at or after the current position in the iteration range.
* @stable ICU 2.0
*/
@@ -535,12 +535,12 @@ public:
virtual UChar32 previous32(void) = 0;
/**
* Returns FALSE if there are no more code units or code points
* Returns false if there are no more code units or code points
* before the current position in the iteration range.
* This is used with previous() or previous32() in backward
* iteration.
* @return FALSE if there are no more code units or code points
* before the current position in the iteration range, return TRUE otherwise.
* @return false if there are no more code units or code points
* before the current position in the iteration range, return true otherwise.
* @stable ICU 2.0
*/
virtual UBool hasPrevious() = 0;
+5 -5
View File
@@ -53,10 +53,10 @@
*
* <h2>Architecture (User's Guide)</h2>
* <ul>
* <li><a href="http://userguide.icu-project.org/">Introduction</a></li>
* <li><a href="http://userguide.icu-project.org/i18n">Internationalization</a></li>
* <li><a href="http://userguide.icu-project.org/design">Locale Model, Multithreading, Error Handling, etc.</a></li>
* <li><a href="http://userguide.icu-project.org/conversion">Conversion</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/">Introduction</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/i18n">Internationalization</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/design">Locale Model, Multithreading, Error Handling, etc.</a></li>
* <li><a href="https://unicode-org.github.io/icu/userguide/conversion">Conversion</a></li>
* </ul>
*
* <hr>
@@ -149,7 +149,7 @@
* </tr>
* <tr>
* <td>Number Range Formatting<br />(includes currency and unit ranges)</td>
* <td>(no C API)</td>
* <td>unumberrangeformatter.h</td>
* <td>icu::number::NumberRangeFormatter</td>
* </tr>
* <tr>
+2 -2
View File
@@ -106,14 +106,14 @@ public:
/**
* Equality operator.
* @return TRUE if the two DateIntervals are the same
* @return true if the two DateIntervals are the same
* @stable ICU 4.0
*/
virtual UBool operator==(const DateInterval& other) const;
/**
* Non-equality operator
* @return TRUE if the two DateIntervals are not the same
* @return true if the two DateIntervals are not the same
* @stable ICU 4.0
*/
inline UBool operator!=(const DateInterval& other) const;
+17 -17
View File
@@ -159,7 +159,7 @@ public:
* @param outErrorCode Set to an error code if it does not contain one already
* and an error occurred while recording edits.
* Otherwise unchanged.
* @return TRUE if U_FAILURE(outErrorCode)
* @return true if U_FAILURE(outErrorCode)
* @stable ICU 59
*/
UBool copyErrorTo(UErrorCode &outErrorCode) const;
@@ -171,7 +171,7 @@ public:
*/
int32_t lengthDelta() const { return delta; }
/**
* @return TRUE if there are any change edits
* @return true if there are any change edits
* @stable ICU 59
*/
UBool hasChanges() const { return numChanges != 0; }
@@ -207,8 +207,8 @@ public:
*/
Iterator() :
array(nullptr), index(0), length(0),
remaining(0), onlyChanges_(FALSE), coarse(FALSE),
dir(0), changed(FALSE), oldLength_(0), newLength_(0),
remaining(0), onlyChanges_(false), coarse(false),
dir(0), changed(false), oldLength_(0), newLength_(0),
srcIndex(0), replIndex(0), destIndex(0) {}
/**
* Copy constructor.
@@ -226,7 +226,7 @@ public:
* @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return TRUE if there is another edit
* @return true if there is another edit
* @stable ICU 59
*/
UBool next(UErrorCode &errorCode) { return next(onlyChanges_, errorCode); }
@@ -247,11 +247,11 @@ public:
* @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return TRUE if the edit for the source index was found
* @return true if the edit for the source index was found
* @stable ICU 59
*/
UBool findSourceIndex(int32_t i, UErrorCode &errorCode) {
return findIndex(i, TRUE, errorCode) == 0;
return findIndex(i, true, errorCode) == 0;
}
/**
@@ -270,11 +270,11 @@ public:
* @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return TRUE if the edit for the destination index was found
* @return true if the edit for the destination index was found
* @stable ICU 60
*/
UBool findDestinationIndex(int32_t i, UErrorCode &errorCode) {
return findIndex(i, FALSE, errorCode) == 0;
return findIndex(i, false, errorCode) == 0;
}
/**
@@ -328,8 +328,8 @@ public:
/**
* Returns whether the edit currently represented by the iterator is a change edit.
*
* @return TRUE if this edit replaces oldLength() units with newLength() different ones.
* FALSE if oldLength units remain unchanged.
* @return true if this edit replaces oldLength() units with newLength() different ones.
* false if oldLength units remain unchanged.
* @stable ICU 59
*/
UBool hasChange() const { return changed; }
@@ -347,8 +347,8 @@ public:
* {@link #destinationIndex}, or in the replacement string, which starts at
* {@link #replacementIndex}.
*
* @return the number of units in the modified string, if hasChange() is TRUE.
* Same as oldLength if hasChange() is FALSE.
* @return the number of units in the modified string, if hasChange() is true.
* Same as oldLength if hasChange() is false.
* @stable ICU 59
*/
int32_t newLength() const { return newLength_; }
@@ -436,7 +436,7 @@ public:
* @stable ICU 59
*/
Iterator getCoarseChangesIterator() const {
return Iterator(array, length, TRUE, TRUE);
return Iterator(array, length, true, true);
}
/**
@@ -448,7 +448,7 @@ public:
* @stable ICU 59
*/
Iterator getCoarseIterator() const {
return Iterator(array, length, FALSE, TRUE);
return Iterator(array, length, false, true);
}
/**
@@ -460,7 +460,7 @@ public:
* @stable ICU 59
*/
Iterator getFineChangesIterator() const {
return Iterator(array, length, TRUE, FALSE);
return Iterator(array, length, true, false);
}
/**
@@ -471,7 +471,7 @@ public:
* @stable ICU 59
*/
Iterator getFineIterator() const {
return Iterator(array, length, FALSE, FALSE);
return Iterator(array, length, false, false);
}
/**
+4 -4
View File
@@ -85,8 +85,8 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
* by the iterator.
* @param string the string to suppress, such as "Mr."
* @param status error code
* @return returns TRUE if the string was not present and now added,
* FALSE if the call was a no-op because the string was already being suppressed.
* @return returns true if the string was not present and now added,
* false if the call was a no-op because the string was already being suppressed.
* @stable ICU 56
*/
virtual UBool suppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0;
@@ -98,8 +98,8 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
* locale data which may be suppressing certain strings.
* @param string the exception to remove
* @param status error code
* @return returns TRUE if the string was present and now removed,
* FALSE if the call was a no-op because the string was not being suppressed.
* @return returns true if the string was present and now removed,
* false if the call was a no-op because the string was not being suppressed.
* @stable ICU 56
*/
virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0;
+1 -1
View File
@@ -38,6 +38,6 @@
*
* @stable ICU 49
*/
U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);
U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);
#endif
+17 -17
View File
@@ -208,7 +208,7 @@ typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
* @param dontUnload set true if this plugin can't be unloaded
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
/**
@@ -217,7 +217,7 @@ uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
* @param level the level of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
/**
@@ -226,7 +226,7 @@ uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
* @return the level of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UPlugLevel U_EXPORT2
U_CAPI UPlugLevel U_EXPORT2
uplug_getPlugLevel(UPlugData *plug);
/**
@@ -236,7 +236,7 @@ uplug_getPlugLevel(UPlugData *plug);
* @return the lowest level of plug which can currently load
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UPlugLevel U_EXPORT2
U_CAPI UPlugLevel U_EXPORT2
uplug_getCurrentLevel(void);
@@ -245,7 +245,7 @@ uplug_getCurrentLevel(void);
* @return The error code of this plugin's load attempt.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UErrorCode U_EXPORT2
U_CAPI UErrorCode U_EXPORT2
uplug_getPlugLoadStatus(UPlugData *plug);
/**
@@ -254,7 +254,7 @@ uplug_getPlugLoadStatus(UPlugData *plug);
* @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_setPlugName(UPlugData *plug, const char *name);
/**
@@ -263,7 +263,7 @@ uplug_setPlugName(UPlugData *plug, const char *name);
* @return the name of this plugin
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL const char * U_EXPORT2
U_CAPI const char * U_EXPORT2
uplug_getPlugName(UPlugData *plug);
/**
@@ -272,7 +272,7 @@ uplug_getPlugName(UPlugData *plug);
* @return the symbol name, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL const char * U_EXPORT2
U_CAPI const char * U_EXPORT2
uplug_getSymbolName(UPlugData *plug);
/**
@@ -282,7 +282,7 @@ uplug_getSymbolName(UPlugData *plug);
* @return the library name, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL const char * U_EXPORT2
U_CAPI const char * U_EXPORT2
uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
/**
@@ -292,7 +292,7 @@ uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
* @return the library, or NULL
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uplug_getLibrary(UPlugData *plug);
/**
@@ -301,7 +301,7 @@ uplug_getLibrary(UPlugData *plug);
* @return the context, or NULL if not set
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void * U_EXPORT2
U_CAPI void * U_EXPORT2
uplug_getContext(UPlugData *plug);
/**
@@ -310,7 +310,7 @@ uplug_getContext(UPlugData *plug);
* @param context new context to set
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_setContext(UPlugData *plug, void *context);
@@ -321,7 +321,7 @@ uplug_setContext(UPlugData *plug, void *context);
* @return configuration string, or else null.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL const char * U_EXPORT2
U_CAPI const char * U_EXPORT2
uplug_getConfiguration(UPlugData *plug);
/**
@@ -339,7 +339,7 @@ uplug_getConfiguration(UPlugData *plug);
* @return the next oldest plugin, or NULL if no more.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UPlugData* U_EXPORT2
U_CAPI UPlugData* U_EXPORT2
uplug_nextPlug(UPlugData *prior);
/**
@@ -354,7 +354,7 @@ uplug_nextPlug(UPlugData *prior);
* @return the new UPlugData associated with this plugin, or NULL if error.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UPlugData* U_EXPORT2
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
@@ -368,7 +368,7 @@ uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UE
* @return the new UPlugData associated with this plugin, or NULL if error.
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UPlugData* U_EXPORT2
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
/**
@@ -378,7 +378,7 @@ uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *conf
* @param status error result
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL void U_EXPORT2
U_CAPI void U_EXPORT2
uplug_removePlug(UPlugData *plug, UErrorCode *status);
#endif /* U_HIDE_INTERNAL_API */
+11 -11
View File
@@ -95,7 +95,7 @@ public:
/**
* Converts a single domain name label into its ASCII form for DNS lookup.
* If any processing step fails, then info.hasErrors() will be TRUE and
* If any processing step fails, then info.hasErrors() will be true and
* the result might not be an ASCII string.
* The label might be modified according to the types of errors.
* Labels with severe errors will be left in (or turned into) their Unicode form.
@@ -119,7 +119,7 @@ public:
/**
* Converts a single domain name label into its Unicode form for human-readable display.
* If any processing step fails, then info.hasErrors() will be TRUE.
* If any processing step fails, then info.hasErrors() will be true.
* The label might be modified according to the types of errors.
*
* The UErrorCode indicates an error only in exceptional cases,
@@ -141,7 +141,7 @@ public:
/**
* Converts a whole domain name into its ASCII form for DNS lookup.
* If any processing step fails, then info.hasErrors() will be TRUE and
* If any processing step fails, then info.hasErrors() will be true and
* the result might not be an ASCII string.
* The domain name might be modified according to the types of errors.
* Labels with severe errors will be left in (or turned into) their Unicode form.
@@ -165,7 +165,7 @@ public:
/**
* Converts a whole domain name into its Unicode form for human-readable display.
* If any processing step fails, then info.hasErrors() will be TRUE.
* If any processing step fails, then info.hasErrors() will be true.
* The domain name might be modified according to the types of errors.
*
* The UErrorCode indicates an error only in exceptional cases,
@@ -273,10 +273,10 @@ public:
* Constructor for stack allocation.
* @stable ICU 4.6
*/
IDNAInfo() : errors(0), labelErrors(0), isTransDiff(FALSE), isBiDi(FALSE), isOkBiDi(TRUE) {}
IDNAInfo() : errors(0), labelErrors(0), isTransDiff(false), isBiDi(false), isOkBiDi(true) {}
/**
* Were there IDNA processing errors?
* @return TRUE if there were processing errors
* @return true if there were processing errors
* @stable ICU 4.6
*/
UBool hasErrors() const { return errors!=0; }
@@ -288,7 +288,7 @@ public:
*/
uint32_t getErrors() const { return errors; }
/**
* Returns TRUE if transitional and nontransitional processing produce different results.
* Returns true if transitional and nontransitional processing produce different results.
* This is the case when the input label or domain name contains
* one or more deviation characters outside a Punycode label (see UTS #46).
* <ul>
@@ -297,7 +297,7 @@ public:
* <li>With transitional processing, such characters are
* mapped (sharp s/sigma) or removed (joiner/nonjoiner).
* </ul>
* @return TRUE if transitional and nontransitional processing produce different results
* @return true if transitional and nontransitional processing produce different results
* @stable ICU 4.6
*/
UBool isTransitionalDifferent() const { return isTransDiff; }
@@ -310,9 +310,9 @@ private:
void reset() {
errors=labelErrors=0;
isTransDiff=FALSE;
isBiDi=FALSE;
isOkBiDi=TRUE;
isTransDiff=false;
isBiDi=false;
isOkBiDi=true;
}
uint32_t errors, labelErrors;
+9 -10
View File
@@ -1,5 +1,5 @@
// © 2018 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
#ifndef __LOCALEBUILDER_H__
#define __LOCALEBUILDER_H__
@@ -92,11 +92,12 @@ public:
/**
* Resets the LocaleBuilder to match the provided
* [Unicode Locale Identifier](http://www.unicode.org/reports/tr35/tr35.html#unicode_locale_id) .
* Discards the existing state. the empty string cause the builder to be
* reset, like {@link #clear}. Grandfathered tags are converted to their
* canonical form before being processed. Otherwise, the <code>language
* tag</code> must be well-formed, or else the build() method will later
* report an U_ILLEGAL_ARGUMENT_ERROR.
* Discards the existing state.
* The empty string causes the builder to be reset, like {@link #clear}.
* Legacy language tags (marked as “Type: grandfathered” in BCP 47)
* are converted to their canonical form before being processed.
* Otherwise, the <code>language tag</code> must be well-formed,
* or else the build() method will later report an U_ILLEGAL_ARGUMENT_ERROR.
*
* <p>This method clears the internal UErrorCode.
*
@@ -278,18 +279,16 @@ public:
*/
Locale build(UErrorCode& status);
#ifndef U_HIDE_DRAFT_API
/**
* Sets the UErrorCode if an error occurred while recording sets.
* Preserves older error codes in the outErrorCode.
* @param outErrorCode Set to an error code that occurred while setting subtags.
* Unchanged if there is no such error or if outErrorCode
* already contained an error.
* @return TRUE if U_FAILURE(outErrorCode)
* @draft ICU 65
* @return true if U_FAILURE(outErrorCode)
* @stable ICU 65
*/
UBool copyErrorTo(UErrorCode &outErrorCode) const;
#endif /* U_HIDE_DRAFT_API */
private:
friend class LocaleMatcher::Result;
+111 -56
View File
@@ -1,5 +1,5 @@
// © 2019 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html#License
// License & terms of use: http://www.unicode.org/copyright.html
// localematcher.h
// created: 2019may08 Markus W. Scherer
@@ -20,26 +20,24 @@
* \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales.
*/
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Builder option for whether the language subtag or the script subtag is most important.
*
* @see Builder#setFavorSubtag(ULocMatchFavorSubtag)
* @draft ICU 65
* @see LocaleMatcher::Builder#setFavorSubtag(ULocMatchFavorSubtag)
* @stable ICU 65
*/
enum ULocMatchFavorSubtag {
/**
* Language differences are most important, then script differences, then region differences.
* (This is the default behavior.)
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_FAVOR_LANGUAGE,
/**
* Makes script differences matter relatively more than language differences.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_FAVOR_SCRIPT
};
@@ -51,14 +49,14 @@ typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag;
* Builder option for whether all desired locales are treated equally or
* earlier ones are preferred.
*
* @see Builder#setDemotionPerDesiredLocale(ULocMatchDemotion)
* @draft ICU 65
* @see LocaleMatcher::Builder#setDemotionPerDesiredLocale(ULocMatchDemotion)
* @stable ICU 65
*/
enum ULocMatchDemotion {
/**
* All desired locales are treated equally.
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_DEMOTION_NONE,
/**
@@ -85,7 +83,7 @@ enum ULocMatchDemotion {
* this is possible in future versions of the data.)
* </ul>
*
* @draft ICU 65
* @stable ICU 65
*/
ULOCMATCH_DEMOTION_REGION
};
@@ -93,6 +91,8 @@ enum ULocMatchDemotion {
typedef enum ULocMatchDemotion ULocMatchDemotion;
#endif
#ifndef U_FORCE_HIDE_DRAFT_API
/**
* Builder option for whether to include or ignore one-way (fallback) match data.
* The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries.
@@ -107,7 +107,7 @@ typedef enum ULocMatchDemotion ULocMatchDemotion;
* if there is a decent match for the original UI language, we want to use it,
* but not if it is merely a fallback.
*
* @see Builder#setDirection(ULocMatchDirection)
* @see LocaleMatcher::Builder#setDirection(ULocMatchDirection)
* @draft ICU 67
*/
enum ULocMatchDirection {
@@ -129,6 +129,8 @@ enum ULocMatchDirection {
typedef enum ULocMatchDirection ULocMatchDirection;
#endif
#endif // U_FORCE_HIDE_DRAFT_API
struct UHashtable;
U_NAMESPACE_BEGIN
@@ -181,7 +183,7 @@ class XLikelySubtags;
*
* <p>This class is not intended for public subclassing.
*
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API LocaleMatcher : public UMemory {
public:
@@ -189,7 +191,7 @@ public:
* Data for the best-matching pair of a desired and a supported locale.
* Movable but not copyable.
*
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Result : public UMemory {
public:
@@ -198,14 +200,14 @@ public:
* This object will have the same contents that the source object had.
*
* @param src Result to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Result(Result &&src) U_NOEXCEPT;
/**
* Destructor.
*
* @draft ICU 65
* @stable ICU 65
*/
~Result();
@@ -214,28 +216,27 @@ public:
* This object will have the same contents that the source object had.
*
* @param src Result to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Result &operator=(Result &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the best-matching desired locale.
* nullptr if the list of desired locales is empty or if none matched well enough.
*
* @return the best-matching desired locale, or nullptr.
* @draft ICU 65
* @stable ICU 65
*/
inline const Locale *getDesiredLocale() const { return desiredLocale; }
/**
* Returns the best-matching supported locale.
* If none matched well enough, this is the default locale.
* The default locale is nullptr if the list of supported locales is empty and
* no explicit default locale is set.
* The default locale is nullptr if Builder::setNoDefaultLocale() was called,
* or if the list of supported locales is empty and no explicit default locale is set.
*
* @return the best-matching supported locale, or nullptr.
* @draft ICU 65
* @stable ICU 65
*/
inline const Locale *getSupportedLocale() const { return supportedLocale; }
@@ -244,7 +245,7 @@ public:
* -1 if the list of desired locales is empty or if none matched well enough.
*
* @return the index of the best-matching desired locale, or -1.
* @draft ICU 65
* @stable ICU 65
*/
inline int32_t getDesiredIndex() const { return desiredIndex; }
@@ -256,7 +257,7 @@ public:
* -1 if the list of supported locales is empty or if none matched well enough.
*
* @return the index of the best-matching supported locale, or -1.
* @draft ICU 65
* @stable ICU 65
*/
inline int32_t getSupportedIndex() const { return supportedIndex; }
@@ -270,10 +271,9 @@ public:
* <p>Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
*
* @return a locale combining the best-matching desired and supported locales.
* @draft ICU 65
* @stable ICU 65
*/
Locale makeResolvedLocale(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
Result(const Locale *desired, const Locale *supported,
@@ -298,8 +298,7 @@ public:
* LocaleMatcher builder.
* Movable but not copyable.
*
* @see LocaleMatcher#builder()
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Builder : public UMemory {
public:
@@ -307,7 +306,7 @@ public:
* Constructs a builder used in chaining parameters for building a LocaleMatcher.
*
* @return a new Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder() {}
@@ -316,14 +315,14 @@ public:
* This builder will have the same contents that the source builder had.
*
* @param src Builder to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Builder(Builder &&src) U_NOEXCEPT;
/**
* Destructor.
*
* @draft ICU 65
* @stable ICU 65
*/
~Builder();
@@ -332,11 +331,10 @@ public:
* This builder will have the same contents that the source builder had.
*
* @param src Builder to move contents from.
* @draft ICU 65
* @stable ICU 65
*/
Builder &operator=(Builder &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Parses an Accept-Language string
* (<a href="https://tools.ietf.org/html/rfc2616#section-14.4">RFC 2616 Section 14.4</a>),
@@ -346,7 +344,7 @@ public:
*
* @param locales the Accept-Language string of locales to set
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setSupportedLocalesFromListString(StringPiece locales);
@@ -357,7 +355,7 @@ public:
*
* @param locales the list of locale
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setSupportedLocales(Locale::Iterator &locales);
@@ -372,7 +370,7 @@ public:
* @param begin Start of range.
* @param end Exclusive end of range.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter>
Builder &setSupportedLocales(Iter begin, Iter end) {
@@ -397,7 +395,7 @@ public:
* @param end Exclusive end of range.
* @param converter Converter from *begin to const Locale & or compatible.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter, typename Conv>
Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) {
@@ -415,17 +413,31 @@ public:
*
* @param locale another locale
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &addSupportedLocale(const Locale &locale);
#ifndef U_HIDE_DRAFT_API
/**
* Sets no default locale.
* There will be no explicit or implicit default locale.
* If there is no good match, then the matcher will return nullptr for the
* best supported locale.
*
* @draft ICU 68
*/
Builder &setNoDefaultLocale();
#endif // U_HIDE_DRAFT_API
/**
* Sets the default locale; if nullptr, or if it is not set explicitly,
* then the first supported locale is used as the default locale.
* There is no default locale at all (nullptr will be returned instead)
* if setNoDefaultLocale() is called.
*
* @param defaultLocale the default locale (will be copied)
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setDefaultLocale(const Locale *defaultLocale);
@@ -437,7 +449,7 @@ public:
*
* @param subtag the subtag to favor
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setFavorSubtag(ULocMatchFavorSubtag subtag);
@@ -447,10 +459,11 @@ public:
*
* @param demotion the demotion per desired locale to set.
* @return this Builder object
* @draft ICU 65
* @stable ICU 65
*/
Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
#ifndef U_HIDE_DRAFT_API
/**
* Option for whether to include or ignore one-way (fallback) match data.
* By default, they are included.
@@ -465,6 +478,32 @@ public:
}
return *this;
}
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_DRAFT_API
/**
* Sets the maximum distance for an acceptable match.
* The matcher will return a match for a pair of locales only if
* they match at least as well as the pair given here.
*
* For example, setMaxDistance(en-US, en-GB) limits matches to ones where the
* (desired, support) locales have a distance no greater than a region subtag difference.
* This is much stricter than the CLDR default.
*
* The details of locale matching are subject to changes in
* CLDR data and in the algorithm.
* Specifying a maximum distance in relative terms via a sample pair of locales
* insulates from changes that affect all distance metrics similarly,
* but some changes will necessarily affect relative distances between
* different pairs of locales.
*
* @param desired the desired locale for distance comparison.
* @param supported the supported locale for distance comparison.
* @return this Builder object
* @draft ICU 68
*/
Builder &setMaxDistance(const Locale &desired, const Locale &supported);
#endif // U_HIDE_DRAFT_API
/**
* Sets the UErrorCode if an error occurred while setting parameters.
@@ -473,8 +512,8 @@ public:
* @param outErrorCode Set to an error code if it does not contain one already
* and an error occurred while setting parameters.
* Otherwise unchanged.
* @return TRUE if U_FAILURE(outErrorCode)
* @draft ICU 65
* @return true if U_FAILURE(outErrorCode)
* @stable ICU 65
*/
UBool copyErrorTo(UErrorCode &outErrorCode) const;
@@ -485,11 +524,10 @@ public:
* @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return new LocaleMatcher.
* @draft ICU 65
* @return LocaleMatcher
* @stable ICU 65
*/
LocaleMatcher build(UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
private:
friend class LocaleMatcher;
@@ -505,8 +543,11 @@ public:
int32_t thresholdDistance_ = -1;
ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION;
Locale *defaultLocale_ = nullptr;
bool withDefault_ = true;
ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE;
ULocMatchDirection direction_ = ULOCMATCH_DIRECTION_WITH_ONE_WAY;
Locale *maxDistanceDesired_ = nullptr;
Locale *maxDistanceSupported_ = nullptr;
};
// FYI No public LocaleMatcher constructors in C++; use the Builder.
@@ -515,13 +556,13 @@ public:
* Move copy constructor; might modify the source.
* This matcher will have the same settings that the source matcher had.
* @param src source matcher
* @draft ICU 65
* @stable ICU 65
*/
LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
/**
* Destructor.
* @draft ICU 65
* @stable ICU 65
*/
~LocaleMatcher();
@@ -531,11 +572,10 @@ public:
* The behavior is undefined if *this and src are the same object.
* @param src source matcher
* @return *this
* @draft ICU 65
* @stable ICU 65
*/
LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
#ifndef U_HIDE_DRAFT_API
/**
* Returns the supported locale which best matches the desired locale.
*
@@ -544,7 +584,7 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return the best-matching supported locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const;
@@ -556,7 +596,7 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return the best-matching supported locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
@@ -572,7 +612,7 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return the best-matching supported locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const;
@@ -586,7 +626,7 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return the best-matching pair of the desired and a supported locale.
* @draft ICU 65
* @stable ICU 65
*/
Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const;
@@ -600,9 +640,25 @@ public:
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return the best-matching pair of a desired and a supported locale.
* @draft ICU 65
* @stable ICU 65
*/
Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
#ifndef U_HIDE_DRAFT_API
/**
* Returns true if the pair of locales matches acceptably.
* This is influenced by Builder options such as setDirection(), setFavorSubtag(),
* and setMaxDistance().
*
* @param desired The desired locale.
* @param supported The supported locale.
* @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
* or else the function returns immediately. Check for U_FAILURE()
* on output or use with function chaining. (See User Guide for details.)
* @return true if the pair of locales matches acceptably.
* @draft ICU 68
*/
UBool isMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const;
#endif // U_HIDE_DRAFT_API
#ifndef U_HIDE_INTERNAL_API
@@ -660,6 +716,5 @@ private:
U_NAMESPACE_END
#endif // U_FORCE_HIDE_DRAFT_API
#endif // U_SHOW_CPLUSPLUS_API
#endif // __LOCALEMATCHER_H__
+2 -2
View File
@@ -88,13 +88,13 @@ public:
~LocalPointerBase() { /* delete ptr; */ }
/**
* NULL check.
* @return TRUE if ==NULL
* @return true if ==NULL
* @stable ICU 4.4
*/
UBool isNull() const { return ptr==NULL; }
/**
* NULL check.
* @return TRUE if !=NULL
* @return true if !=NULL
* @stable ICU 4.4
*/
UBool isValid() const { return ptr!=NULL; }
+30 -28
View File
@@ -253,7 +253,7 @@ public:
/**
* Construct a locale from language, country, variant.
* If an error occurs, then the constructed object will be "bogus"
* (isBogus() will return TRUE).
* (isBogus() will return true).
*
* @param language Lowercase two-letter or three-letter ISO-639 code.
* This parameter can instead be an ICU style C locale (e.g. "en_US"),
@@ -393,13 +393,17 @@ public:
* If the specified language tag contains any ill-formed subtags,
* the first such subtag and all following subtags are ignored.
* <p>
* This implements the 'Language-Tag' production of BCP47, and so
* supports grandfathered (regular and irregular) as well as private
* use language tags. Private use tags are represented as 'x-whatever',
* and grandfathered tags are converted to their canonical replacements
* where they exist. Note that a few grandfathered tags have no modern
* replacement, these will be converted using the fallback described in
* This implements the 'Language-Tag' production of BCP 47, and so
* supports legacy language tags (marked as “Type: grandfathered” in BCP 47)
* (regular and irregular) as well as private use language tags.
*
* Private use tags are represented as 'x-whatever',
* and legacy tags are converted to their canonical replacements where they exist.
*
* Note that a few legacy tags have no modern replacement;
* these will be converted using the fallback described in
* the first paragraph, so some information might be lost.
*
* @param tag the input BCP47 language tag.
* @param status error information if creating the Locale failed.
* @return the Locale for the specified BCP47 language tag.
@@ -795,14 +799,14 @@ public:
/**
* Returns whether this locale's script is written right-to-left.
* If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags().
* If no likely script is known, then FALSE is returned.
* If no likely script is known, then false is returned.
*
* A script is right-to-left according to the CLDR script metadata
* which corresponds to whether the script's letters have Bidi_Class=R or AL.
*
* Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl".
* Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl".
*
* @return TRUE if the locale's script is written right-to-left
* @return true if the locale's script is written right-to-left
* @stable ICU 54
*/
UBool isRightToLeft() const;
@@ -956,7 +960,7 @@ public:
/**
* Gets the bogus state. Locale object can be bogus if it doesn't exist
* @return FALSE if it is a real locale, TRUE if it is a bogus locale
* @return false if it is a real locale, true if it is a bogus locale
* @stable ICU 2.1
*/
inline UBool isBogus(void) const;
@@ -1005,32 +1009,31 @@ public:
*/
virtual UClassID getDynamicClassID() const;
#ifndef U_HIDE_DRAFT_API
/**
* A Locale iterator interface similar to a Java Iterator<Locale>.
* @draft ICU 65
* @stable ICU 65
*/
class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ {
public:
/** @draft ICU 65 */
/** @stable ICU 65 */
virtual ~Iterator();
/**
* @return TRUE if next() can be called again.
* @draft ICU 65
* @return true if next() can be called again.
* @stable ICU 65
*/
virtual UBool hasNext() const = 0;
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
virtual const Locale &next() = 0;
};
/**
* A generic Locale iterator implementation over Locale input iterators.
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter>
class RangeIterator : public Iterator, public UMemory {
@@ -1042,19 +1045,19 @@ public:
*
* @param begin Start of range.
* @param end Exclusive end of range.
* @draft ICU 65
* @stable ICU 65
*/
RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
/**
* @return TRUE if next() can be called again.
* @draft ICU 65
* @return true if next() can be called again.
* @stable ICU 65
*/
UBool hasNext() const override { return it_ != end_; }
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale &next() override { return *it_++; }
@@ -1066,7 +1069,7 @@ public:
/**
* A generic Locale iterator implementation over Locale input iterators.
* Calls the converter to convert each *begin to a const Locale &.
* @draft ICU 65
* @stable ICU 65
*/
template<typename Iter, typename Conv>
class ConvertingIterator : public Iterator, public UMemory {
@@ -1079,20 +1082,20 @@ public:
* @param begin Start of range.
* @param end Exclusive end of range.
* @param converter Converter from *begin to const Locale & or compatible.
* @draft ICU 65
* @stable ICU 65
*/
ConvertingIterator(Iter begin, Iter end, Conv converter) :
it_(begin), end_(end), converter_(converter) {}
/**
* @return TRUE if next() can be called again.
* @draft ICU 65
* @return true if next() can be called again.
* @stable ICU 65
*/
UBool hasNext() const override { return it_ != end_; }
/**
* @return the next locale.
* @draft ICU 65
* @stable ICU 65
*/
const Locale &next() override { return converter_(*it_++); }
@@ -1101,7 +1104,6 @@ public:
const Iter end_;
Conv converter_;
};
#endif // U_HIDE_DRAFT_API
protected: /* only protected for testing purposes. DO NOT USE. */
#ifndef U_HIDE_INTERNAL_API
+12 -12
View File
@@ -265,7 +265,7 @@ typedef enum UMessagePatternArgType UMessagePatternArgType;
/**
* \def UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE
* Returns TRUE if the argument type has a plural style part sequence and semantics,
* Returns true if the argument type has a plural style part sequence and semantics,
* for example UMSGPAT_ARG_TYPE_PLURAL and UMSGPAT_ARG_TYPE_SELECTORDINAL.
* @stable ICU 50
*/
@@ -523,14 +523,14 @@ public:
/**
* @param other another object to compare with.
* @return TRUE if this object is equivalent to the other one.
* @return true if this object is equivalent to the other one.
* @stable ICU 4.8
*/
UBool operator==(const MessagePattern &other) const;
/**
* @param other another object to compare with.
* @return FALSE if this object is equivalent to the other one.
* @return false if this object is equivalent to the other one.
* @stable ICU 4.8
*/
inline UBool operator!=(const MessagePattern &other) const {
@@ -564,7 +564,7 @@ public:
/**
* Does the parsed pattern have named arguments like {first_name}?
* @return TRUE if the parsed pattern has at least one named argument.
* @return true if the parsed pattern has at least one named argument.
* @stable ICU 4.8
*/
UBool hasNamedArguments() const {
@@ -573,7 +573,7 @@ public:
/**
* Does the parsed pattern have numbered arguments like {2}?
* @return TRUE if the parsed pattern has at least one numbered argument.
* @return true if the parsed pattern has at least one numbered argument.
* @stable ICU 4.8
*/
UBool hasNumberedArguments() const {
@@ -664,7 +664,7 @@ public:
* Compares the part's substring with the input string s.
* @param part a part of this MessagePattern.
* @param s a string.
* @return TRUE if getSubstring(part).equals(s).
* @return true if getSubstring(part).equals(s).
* @stable ICU 4.8
*/
UBool partSubstringMatches(const Part &part, const UnicodeString &s) const {
@@ -785,7 +785,7 @@ public:
* Indicates whether the Part type has a numeric value.
* If so, then that numeric value can be retrieved via MessagePattern.getNumericValue().
* @param type The Part type to be tested.
* @return TRUE if the Part type has a numeric value.
* @return true if the Part type has a numeric value.
* @stable ICU 4.8
*/
static UBool hasNumericValue(UMessagePatternPartType type) {
@@ -794,14 +794,14 @@ public:
/**
* @param other another object to compare with.
* @return TRUE if this object is equivalent to the other one.
* @return true if this object is equivalent to the other one.
* @stable ICU 4.8
*/
UBool operator==(const Part &other) const;
/**
* @param other another object to compare with.
* @return FALSE if this object is equivalent to the other one.
* @return false if this object is equivalent to the other one.
* @stable ICU 4.8
*/
inline UBool operator!=(const Part &other) const {
@@ -869,7 +869,7 @@ private:
* Parses a number from the specified message substring.
* @param start start index into the message string
* @param limit limit index into the message string, must be start<limit
* @param allowInfinity TRUE if U+221E is allowed (for ChoiceFormat)
* @param allowInfinity true if U+221E is allowed (for ChoiceFormat)
* @param parseError
* @param errorCode
*/
@@ -900,13 +900,13 @@ private:
UBool isOrdinal(int32_t index);
/**
* @return TRUE if we are inside a MessageFormat (sub-)pattern,
* @return true if we are inside a MessageFormat (sub-)pattern,
* as opposed to inside a top-level choice/plural/select pattern.
*/
UBool inMessageFormatPattern(int32_t nestingLevel);
/**
* @return TRUE if we are in a MessageFormat sub-pattern
* @return true if we are in a MessageFormat sub-pattern
* of a top-level ChoiceFormat pattern.
*/
UBool inTopLevelChoiceMessage(int32_t nestingLevel, UMessagePatternArgType parentType);
+16 -16
View File
@@ -290,13 +290,13 @@ public:
* Gets the decomposition mapping of c.
* Roughly equivalent to normalizing the String form of c
* on a UNORM2_DECOMPOSE Normalizer2 instance, but much faster, and except that this function
* returns FALSE and does not write a string
* returns false and does not write a string
* if c does not have a decomposition mapping in this instance's data.
* This function is independent of the mode of the Normalizer2.
* @param c code point
* @param decomposition String object which will be set to c's
* decomposition mapping, if there is one.
* @return TRUE if c has a decomposition, otherwise FALSE
* @return true if c has a decomposition, otherwise false
* @stable ICU 4.6
*/
virtual UBool
@@ -319,11 +319,11 @@ public:
* in this case, the result contains either one or two code points (=1..4 char16_ts).
*
* This function is independent of the mode of the Normalizer2.
* The default implementation returns FALSE.
* The default implementation returns false.
* @param c code point
* @param decomposition String object which will be set to c's
* raw decomposition mapping, if there is one.
* @return TRUE if c has a decomposition, otherwise FALSE
* @return true if c has a decomposition, otherwise false
* @stable ICU 49
*/
virtual UBool
@@ -369,7 +369,7 @@ public:
* pass the U_SUCCESS() test, or else the function returns
* immediately. Check for U_FAILURE() on output or use with
* function chaining. (See User Guide for details.)
* @return TRUE if s is normalized
* @return true if s is normalized
* @stable ICU 4.4
*/
virtual UBool
@@ -392,7 +392,7 @@ public:
* pass the U_SUCCESS() test, or else the function returns
* immediately. Check for U_FAILURE() on output or use with
* function chaining. (See User Guide for details.)
* @return TRUE if s is normalized
* @return true if s is normalized
* @stable ICU 60
*/
virtual UBool
@@ -452,7 +452,7 @@ public:
* character independently.
* This is used for iterative normalization. See the class documentation for details.
* @param c character to test
* @return TRUE if c has a normalization boundary before it
* @return true if c has a normalization boundary before it
* @stable ICU 4.4
*/
virtual UBool hasBoundaryBefore(UChar32 c) const = 0;
@@ -468,7 +468,7 @@ public:
* This is used for iterative normalization. See the class documentation for details.
* Note that this operation may be significantly slower than hasBoundaryBefore().
* @param c character to test
* @return TRUE if c has a normalization boundary after it
* @return true if c has a normalization boundary after it
* @stable ICU 4.4
*/
virtual UBool hasBoundaryAfter(UChar32 c) const = 0;
@@ -483,7 +483,7 @@ public:
* This is used for iterative normalization. See the class documentation for details.
* Note that this operation may be significantly slower than hasBoundaryBefore().
* @param c character to test
* @return TRUE if c is normalization-inert
* @return true if c is normalization-inert
* @stable ICU 4.4
*/
virtual UBool isInert(UChar32 c) const = 0;
@@ -612,7 +612,7 @@ public:
* @param c code point
* @param decomposition String object which will be set to c's
* decomposition mapping, if there is one.
* @return TRUE if c has a decomposition, otherwise FALSE
* @return true if c has a decomposition, otherwise false
* @stable ICU 4.6
*/
virtual UBool
@@ -626,7 +626,7 @@ public:
* @param c code point
* @param decomposition String object which will be set to c's
* raw decomposition mapping, if there is one.
* @return TRUE if c has a decomposition, otherwise FALSE
* @return true if c has a decomposition, otherwise false
* @stable ICU 49
*/
virtual UBool
@@ -664,7 +664,7 @@ public:
* pass the U_SUCCESS() test, or else the function returns
* immediately. Check for U_FAILURE() on output or use with
* function chaining. (See User Guide for details.)
* @return TRUE if s is normalized
* @return true if s is normalized
* @stable ICU 4.4
*/
virtual UBool
@@ -687,7 +687,7 @@ public:
* pass the U_SUCCESS() test, or else the function returns
* immediately. Check for U_FAILURE() on output or use with
* function chaining. (See User Guide for details.)
* @return TRUE if s is normalized
* @return true if s is normalized
* @stable ICU 60
*/
virtual UBool
@@ -724,7 +724,7 @@ public:
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c has a normalization boundary before it
* @return true if c has a normalization boundary before it
* @stable ICU 4.4
*/
virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE;
@@ -734,7 +734,7 @@ public:
* regardless of context.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c has a normalization boundary after it
* @return true if c has a normalization boundary after it
* @stable ICU 4.4
*/
virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE;
@@ -743,7 +743,7 @@ public:
* Tests if the character is normalization-inert.
* For details see the Normalizer2 base class documentation.
* @param c character to test
* @return TRUE if c is normalization-inert
* @return true if c is normalization-inert
* @stable ICU 4.4
*/
virtual UBool isInert(UChar32 c) const U_OVERRIDE;
Loaded 100 of 419 files, more files were not shown because too many files have changed in this diff. Show more