Skip to content
Permalink
Browse files

deps: ICU 61.1 bump

- Update to released ICU 61.1, including:
  - CLDR 33 (many new languages and data improvements)
  - Many small API additions, improvements, and bug fixes
  - note: 'icu::' namespace is no longer used by default
   (Necessated #18667 )

PR-URL: #19621
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
srl295 committed Mar 26, 2018
1 parent 88773af commit 64211405dab824a570e52d000891c49415cc42b8
Showing with 8,959 additions and 2,011 deletions.
  1. +31 −2 LICENSE
  2. +2 −2 configure
  3. +31 −2 deps/icu-small/LICENSE
  4. +2 −2 deps/icu-small/README-SMALL-ICU.txt
  5. +2 −2 deps/icu-small/source/common/bmpset.cpp
  6. +27 −38 deps/icu-small/source/common/brkeng.cpp
  7. +9 −24 deps/icu-small/source/common/brkeng.h
  8. +6 −7 deps/icu-small/source/common/brkiter.cpp
  9. +14 −14 deps/icu-small/source/common/bytesinkutil.cpp
  10. +9 −1 deps/icu-small/source/common/bytesinkutil.h
  11. +0 −24 deps/icu-small/source/common/cmemory.cpp
  12. +0 −21 deps/icu-small/source/common/cmemory.h
  13. +0 −18 deps/icu-small/source/common/cstring.h
  14. +12 −17 deps/icu-small/source/common/dictbe.cpp
  15. +3 −28 deps/icu-small/source/common/dictbe.h
  16. +5 −0 deps/icu-small/source/common/filteredbrk.cpp
  17. +90 −105 deps/icu-small/source/common/rbbi.cpp
  18. +22 −25 deps/icu-small/source/common/rbbi_cache.cpp
  19. +1 −1 deps/icu-small/source/common/rbbi_cache.h
  20. +2 −2 deps/icu-small/source/common/rbbidata.cpp
  21. +7 −9 deps/icu-small/source/common/rbbidata.h
  22. +37 −8 deps/icu-small/source/common/rbbirb.cpp
  23. +9 −0 deps/icu-small/source/common/rbbirb.h
  24. +16 −15 deps/icu-small/source/common/rbbiscan.cpp
  25. +38 −17 deps/icu-small/source/common/rbbisetb.cpp
  26. +9 −1 deps/icu-small/source/common/rbbisetb.h
  27. +131 −13 deps/icu-small/source/common/rbbitblb.cpp
  28. +41 −4 deps/icu-small/source/common/rbbitblb.h
  29. +22 −47 deps/icu-small/source/common/sharedobject.cpp
  30. +32 −84 deps/icu-small/source/common/sharedobject.h
  31. +0 −1 deps/icu-small/source/common/sprpimpl.h
  32. +2 −5 deps/icu-small/source/common/ubidi.cpp
  33. +45 −58 deps/icu-small/source/common/ubidi_props.cpp
  34. +11 −17 deps/icu-small/source/common/ubidi_props.h
  35. +0 −2 deps/icu-small/source/common/ubidiimp.h
  36. +150 −15 deps/icu-small/source/common/ucase.cpp
  37. +35 −0 deps/icu-small/source/common/ucase.h
  38. +224 −48 deps/icu-small/source/common/ucasemap.cpp
  39. +0 −9 deps/icu-small/source/common/ucasemap_imp.h
  40. +0 −8 deps/icu-small/source/common/uchar.cpp
  41. +5 −1 deps/icu-small/source/common/ucmndata.cpp
  42. +5 −1 deps/icu-small/source/common/ucmndata.h
  43. +2 −2 deps/icu-small/source/common/ucnv2022.cpp
  44. +11 −21 deps/icu-small/source/common/ucnv_err.cpp
  45. +4 −4 deps/icu-small/source/common/ucnv_u32.cpp
  46. +15 −39 deps/icu-small/source/common/ucnv_u8.cpp
  47. +6 −2 deps/icu-small/source/common/ucnvlat1.cpp
  48. +6 −4 deps/icu-small/source/common/ucnvmbcs.cpp
  49. +19 −10 deps/icu-small/source/common/ucurr.cpp
  50. +7 −8 deps/icu-small/source/common/unicode/brkiter.h
  51. +0 −1 deps/icu-small/source/common/unicode/bytestriebuilder.h
  52. +11 −13 deps/icu-small/source/common/unicode/casemap.h
  53. +20 −24 deps/icu-small/source/common/unicode/char16ptr.h
  54. +1 −1 deps/icu-small/source/common/unicode/chariter.h
  55. +1 −1 deps/icu-small/source/common/unicode/dtintrv.h
  56. +30 −28 deps/icu-small/source/common/unicode/edits.h
  57. +1 −5 deps/icu-small/source/common/unicode/filteredbrk.h
  58. +2 −2 deps/icu-small/source/common/unicode/locid.h
  59. +2 −2 deps/icu-small/source/common/unicode/parseerr.h
  60. +7 −5 deps/icu-small/source/common/unicode/platform.h
  61. +3 −3 deps/icu-small/source/common/unicode/putil.h
  62. +56 −68 deps/icu-small/source/common/unicode/rbbi.h
  63. +1 −1 deps/icu-small/source/common/unicode/resbund.h
  64. +1 −1 deps/icu-small/source/common/unicode/schriter.h
  65. +2 −2 deps/icu-small/source/common/unicode/ubidi.h
  66. +6 −12 deps/icu-small/source/common/unicode/ubrk.h
  67. +3 −4 deps/icu-small/source/common/unicode/uchar.h
  68. +8 −8 deps/icu-small/source/common/unicode/uclean.h
  69. +4 −4 deps/icu-small/source/common/unicode/ucnv.h
  70. +6 −6 deps/icu-small/source/common/unicode/ucnv_err.h
  71. +13 −0 deps/icu-small/source/common/unicode/ucurr.h
  72. +5 −1 deps/icu-small/source/common/unicode/umachine.h
  73. +1 −0 deps/icu-small/source/common/unicode/uniset.h
  74. +9 −45 deps/icu-small/source/common/unicode/unistr.h
  75. +2 −3 deps/icu-small/source/common/unicode/urename.h
  76. +8 −8 deps/icu-small/source/common/unicode/ures.h
  77. +1 −1 deps/icu-small/source/common/unicode/uscript.h
  78. +1 −1 deps/icu-small/source/common/unicode/ushape.h
  79. +5 −5 deps/icu-small/source/common/unicode/usprep.h
  80. +2 −2 deps/icu-small/source/common/unicode/ustring.h
  81. +4 −4 deps/icu-small/source/common/unicode/utext.h
  82. +106 −60 deps/icu-small/source/common/unicode/utf8.h
  83. +2 −2 deps/icu-small/source/common/unicode/utrace.h
  84. +10 −7 deps/icu-small/source/common/unicode/utypes.h
  85. +16 −9 deps/icu-small/source/common/unicode/uvernum.h
  86. +8 −2 deps/icu-small/source/common/unicode/uversion.h
  87. +134 −170 deps/icu-small/source/common/unifiedcache.cpp
  88. +182 −28 deps/icu-small/source/common/unifiedcache.h
  89. +1 −1 deps/icu-small/source/common/uniset_closure.cpp
  90. +25 −3 deps/icu-small/source/common/uniset_props.cpp
  91. +7 −9 deps/icu-small/source/common/uprops.cpp
  92. +2 −4 deps/icu-small/source/common/ushape.cpp
  93. +1 −5 deps/icu-small/source/common/usprep.cpp
  94. +1 −1 deps/icu-small/source/common/ustr_wcs.cpp
  95. +228 −77 deps/icu-small/source/common/ustrcase.cpp
  96. +42 −45 deps/icu-small/source/common/utf_impl.cpp
  97. +1 −1 deps/icu-small/source/common/utrie.h
  98. +2 −3 deps/icu-small/source/common/uts46.cpp
  99. +2 −1 deps/icu-small/source/common/utypes.cpp
  100. BIN deps/icu-small/source/data/in/{icudt60l.dat → icudt61l.dat}
  101. +4 −9 deps/icu-small/source/i18n/alphaindex.cpp
  102. +4 −4 deps/icu-small/source/i18n/calendar.cpp
  103. +3 −3 deps/icu-small/source/i18n/collationiterator.h
  104. +23 −0 deps/icu-small/source/i18n/dcfmtsym.cpp
  105. +3 −1 deps/icu-small/source/i18n/decNumber.cpp
  106. +6 −4 deps/icu-small/source/i18n/decimalformatpattern.cpp
  107. +49 −1 deps/icu-small/source/i18n/digitlst.cpp
  108. +659 −0 deps/icu-small/source/i18n/double-conversion-bignum-dtoa.cpp
  109. +102 −0 deps/icu-small/source/i18n/double-conversion-bignum-dtoa.h
  110. +784 −0 deps/icu-small/source/i18n/double-conversion-bignum.cpp
  111. +162 −0 deps/icu-small/source/i18n/double-conversion-bignum.h
  112. +193 −0 deps/icu-small/source/i18n/double-conversion-cached-powers.cpp
  113. +82 −0 deps/icu-small/source/i18n/double-conversion-cached-powers.h
  114. +74 −0 deps/icu-small/source/i18n/double-conversion-diy-fp.cpp
  115. +136 −0 deps/icu-small/source/i18n/double-conversion-diy-fp.h
  116. +683 −0 deps/icu-small/source/i18n/double-conversion-fast-dtoa.cpp
  117. +106 −0 deps/icu-small/source/i18n/double-conversion-fast-dtoa.h
  118. +420 −0 deps/icu-small/source/i18n/double-conversion-ieee.h
  119. +358 −0 deps/icu-small/source/i18n/double-conversion-utils.h
  120. +1,005 −0 deps/icu-small/source/i18n/double-conversion.cpp
  121. +566 −0 deps/icu-small/source/i18n/double-conversion.h
  122. +67 −23 deps/icu-small/source/i18n/dtptngen.cpp
  123. +1 −1 deps/icu-small/source/i18n/islamcal.cpp
  124. +9 −4 deps/icu-small/source/i18n/measfmt.cpp
  125. +7 −4 deps/icu-small/source/i18n/measunit.cpp
  126. +7 −4 deps/icu-small/source/i18n/nfrs.cpp
  127. +1 −1 deps/icu-small/source/i18n/nfrs.h
  128. +6 −0 deps/icu-small/source/i18n/nfrule.cpp
  129. +2 −0 deps/icu-small/source/i18n/nfrule.h
  130. +14 −7 deps/icu-small/source/i18n/nfsubs.cpp
  131. +1 −0 deps/icu-small/source/i18n/nfsubs.h
  132. +1 −0 deps/icu-small/source/i18n/number_affixutils.cpp
  133. +0 −7 deps/icu-small/source/i18n/number_compact.cpp
  134. +0 −1 deps/icu-small/source/i18n/number_compact.h
  135. +45 −22 deps/icu-small/source/i18n/number_decimalquantity.cpp
  136. +5 −0 deps/icu-small/source/i18n/number_decimalquantity.h
  137. +2 −2 deps/icu-small/source/i18n/number_decimfmtprops.h
  138. +27 −4 deps/icu-small/source/i18n/number_fluent.cpp
  139. +83 −26 deps/icu-small/source/i18n/number_formatimpl.cpp
  140. +47 −13 deps/icu-small/source/i18n/number_grouping.cpp
  141. +9 −6 deps/icu-small/source/i18n/number_integerwidth.cpp
  142. +126 −24 deps/icu-small/source/i18n/number_longnames.cpp
  143. +10 −2 deps/icu-small/source/i18n/number_longnames.h
  144. +49 −27 deps/icu-small/source/i18n/number_modifiers.cpp
  145. +31 −16 deps/icu-small/source/i18n/number_modifiers.h
  146. +3 −3 deps/icu-small/source/i18n/number_notation.cpp
  147. +1 −1 deps/icu-small/source/i18n/number_padding.cpp
  148. +48 −24 deps/icu-small/source/i18n/number_patternmodifier.cpp
  149. +8 −8 deps/icu-small/source/i18n/number_patternmodifier.h
  150. +4 −0 deps/icu-small/source/i18n/number_patternstring.cpp
  151. +2 −0 deps/icu-small/source/i18n/number_patternstring.h
  152. +54 −42 deps/icu-small/source/i18n/number_rounding.cpp
  153. +37 −0 deps/icu-small/source/i18n/number_stringbuilder.cpp
  154. +5 −0 deps/icu-small/source/i18n/number_stringbuilder.h
  155. +19 −5 deps/icu-small/source/i18n/number_types.h
  156. +1 −1 deps/icu-small/source/i18n/rbnf.cpp
  157. +2 −4 deps/icu-small/source/i18n/regexcmp.cpp
  158. +2 −2 deps/icu-small/source/i18n/rematch.cpp
  159. +2 −2 deps/icu-small/source/i18n/simpletz.cpp
  160. +1 −0 deps/icu-small/source/i18n/ucol.cpp
  161. +1 −0 deps/icu-small/source/i18n/ucol_res.cpp
  162. +19 −0 deps/icu-small/source/i18n/udatpg.cpp
  163. +9 −1 deps/icu-small/source/i18n/unicode/compactdecimalformat.h
  164. +2 −1 deps/icu-small/source/i18n/unicode/datefmt.h
  165. +59 −8 deps/icu-small/source/i18n/unicode/dcfmtsym.h
  166. +25 −2 deps/icu-small/source/i18n/unicode/decimfmt.h
  167. +26 −4 deps/icu-small/source/i18n/unicode/dtptngen.h
  168. +16 −3 deps/icu-small/source/i18n/unicode/measfmt.h
  169. +3 −5 deps/icu-small/source/i18n/unicode/measunit.h
  170. +5 −5 deps/icu-small/source/i18n/unicode/nounit.h
  171. +307 −111 deps/icu-small/source/i18n/unicode/numberformatter.h
  172. +32 −5 deps/icu-small/source/i18n/unicode/numfmt.h
  173. +4 −2 deps/icu-small/source/i18n/unicode/simpletz.h
  174. +52 −1 deps/icu-small/source/i18n/unicode/udatpg.h
  175. +5 −4 deps/icu-small/source/i18n/unicode/unum.h
  176. +2 −4 deps/icu-small/source/i18n/unicode/upluralrules.h
  177. +2 −2 deps/icu-small/source/i18n/unicode/utrans.h
  178. +4 −2 deps/icu-small/source/i18n/uregex.cpp
  179. +5 −5 deps/icu-small/source/i18n/utrans.cpp
  180. +77 −61 deps/icu-small/source/tools/escapesrc/escapesrc.cpp
33 LICENSE
@@ -122,8 +122,8 @@ The externally maintained libraries used by Node.js are:
"""
COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)

Copyright © 1991-2017 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html
Copyright © 1991-2018 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
@@ -505,6 +505,35 @@ The externally maintained libraries used by Node.js are:
# by ICANN or the IETF Trust on the database or the code. Any person
# making a contribution to the database or code waives all rights to
# future claims in that contribution or in the TZ Database.

6. Google double-conversion

Copyright 2006-2011, the V8 project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

- libuv, located at deps/uv, is licensed as follows:
@@ -1125,8 +1125,8 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
def configure_intl(o):
icus = [
{
'url': 'https://ssl.icu-project.org/files/icu4c/60.2/icu4c-60_2-src.zip',
'md5': '115908818fd0324530b2acb1b029738d',
'url': 'https://ssl.icu-project.org/files/icu4c/61.1/icu4c-61_1-src.zip',
'md5': '780d8524c8a860ed8d8f6fe75cb7ce3f',
},
]
def icu_download(path):
@@ -1,7 +1,7 @@
COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)

Copyright © 1991-2017 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html
Copyright © 1991-2018 Unicode, Inc. All rights reserved.
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the Unicode data files and any associated documentation
@@ -383,3 +383,32 @@ Database section 7.
# by ICANN or the IETF Trust on the database or the code. Any person
# making a contribution to the database or code waives all rights to
# future claims in that contribution or in the TZ Database.

6. Google double-conversion

Copyright 2006-2011, the V8 project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,8 +1,8 @@
Small ICU sources - auto generated by shrink-icu-src.py

This directory contains the ICU subset used by --with-intl=small-icu (the default)
It is a strict subset of ICU 60 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt60l.dat : Reduced-size data file
It is a strict subset of ICU 61 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt61l.dat : Reduced-size data file


To rebuild this directory, see ../../tools/icu/README.md
@@ -100,9 +100,9 @@ static void set32x64Bits(uint32_t table[64], int32_t start, int32_t limit) {
++lead;
}
if(lead<limitLead) {
bits=~((1<<lead)-1);
bits=~(((unsigned)1<<lead)-1);
if(limitLead<0x20) {
bits&=(1<<limitLead)-1;
bits&=((unsigned)1<<limitLead)-1;
}
for(trail=0; trail<64; ++trail) {
table[trail]|=bits;
@@ -59,58 +59,47 @@ LanguageBreakFactory::~LanguageBreakFactory() {
******************************************************************
*/

UnhandledEngine::UnhandledEngine(UErrorCode &/*status*/) {
for (int32_t i = 0; i < UPRV_LENGTHOF(fHandled); ++i) {
fHandled[i] = 0;
}
UnhandledEngine::UnhandledEngine(UErrorCode &status) : fHandled(nullptr) {
(void)status;
}

UnhandledEngine::~UnhandledEngine() {
for (int32_t i = 0; i < UPRV_LENGTHOF(fHandled); ++i) {
if (fHandled[i] != 0) {
delete fHandled[i];
}
}
delete fHandled;
fHandled = nullptr;
}

UBool
UnhandledEngine::handles(UChar32 c, int32_t breakType) const {
return (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)
&& fHandled[breakType] != 0 && fHandled[breakType]->contains(c));
UnhandledEngine::handles(UChar32 c) const {
return fHandled && fHandled->contains(c);
}

int32_t
UnhandledEngine::findBreaks( UText *text,
int32_t /* startPos */,
int32_t endPos,
int32_t breakType,
UVector32 &/*foundBreaks*/ ) const {
if (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)) {
UChar32 c = utext_current32(text);
while((int32_t)utext_getNativeIndex(text) < endPos && fHandled[breakType]->contains(c)) {
utext_next32(text); // TODO: recast loop to work with post-increment operations.
c = utext_current32(text);
}
UChar32 c = utext_current32(text);
while((int32_t)utext_getNativeIndex(text) < endPos && fHandled->contains(c)) {
utext_next32(text); // TODO: recast loop to work with post-increment operations.
c = utext_current32(text);
}
return 0;
}

void
UnhandledEngine::handleCharacter(UChar32 c, int32_t breakType) {
if (breakType >= 0 && breakType < UPRV_LENGTHOF(fHandled)) {
if (fHandled[breakType] == 0) {
fHandled[breakType] = new UnicodeSet();
if (fHandled[breakType] == 0) {
return;
}
}
if (!fHandled[breakType]->contains(c)) {
UErrorCode status = U_ZERO_ERROR;
// Apply the entire script of the character.
int32_t script = u_getIntPropertyValue(c, UCHAR_SCRIPT);
fHandled[breakType]->applyIntPropertyValue(UCHAR_SCRIPT, script, status);
UnhandledEngine::handleCharacter(UChar32 c) {
if (fHandled == nullptr) {
fHandled = new UnicodeSet();
if (fHandled == nullptr) {
return;
}
}
if (!fHandled->contains(c)) {
UErrorCode status = U_ZERO_ERROR;
// Apply the entire script of the character.
int32_t script = u_getIntPropertyValue(c, UCHAR_SCRIPT);
fHandled->applyIntPropertyValue(UCHAR_SCRIPT, script, status);
}
}

/*
@@ -138,7 +127,7 @@ U_NAMESPACE_BEGIN
static UMutex gBreakEngineMutex = U_MUTEX_INITIALIZER;

const LanguageBreakEngine *
ICULanguageBreakFactory::getEngineFor(UChar32 c, int32_t breakType) {
ICULanguageBreakFactory::getEngineFor(UChar32 c) {
const LanguageBreakEngine *lbe = NULL;
UErrorCode status = U_ZERO_ERROR;

@@ -156,26 +145,26 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c, int32_t breakType) {
int32_t i = fEngines->size();
while (--i >= 0) {
lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i));
if (lbe != NULL && lbe->handles(c, breakType)) {
if (lbe != NULL && lbe->handles(c)) {
return lbe;
}
}
}

// We didn't find an engine. Create one.
lbe = loadEngineFor(c, breakType);
lbe = loadEngineFor(c);
if (lbe != NULL) {
fEngines->push((void *)lbe, status);
}
return lbe;
}

const LanguageBreakEngine *
ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
UErrorCode status = U_ZERO_ERROR;
UScriptCode code = uscript_getScript(c, &status);
if (U_SUCCESS(status)) {
DictionaryMatcher *m = loadDictionaryMatcherFor(code, breakType);
DictionaryMatcher *m = loadDictionaryMatcherFor(code);
if (m != NULL) {
const LanguageBreakEngine *engine = NULL;
switch(code) {
@@ -236,7 +225,7 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c, int32_t breakType) {
}

DictionaryMatcher *
ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script, int32_t /* brkType */) {
ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
UErrorCode status = U_ZERO_ERROR;
// open root from brkitr tree.
UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);
@@ -54,11 +54,10 @@ class LanguageBreakEngine : public UMemory {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @param breakType The type of text break which the caller wants to determine
* @return TRUE if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c, int32_t breakType) const = 0;
virtual UBool handles(UChar32 c) const = 0;

/**
* <p>Find any breaks within a run in the supplied text.</p>
@@ -68,14 +67,12 @@ class LanguageBreakEngine : public UMemory {
* is capable of handling.
* @param startPos The start of the run within the supplied text.
* @param endPos The end of the run within the supplied text.
* @param breakType The type of break desired, or -1.
* @param foundBreaks A Vector of int32_t to receive the breaks.
* @return The number of breaks found.
*/
virtual int32_t findBreaks( UText *text,
int32_t startPos,
int32_t endPos,
int32_t breakType,
UVector32 &foundBreaks ) const = 0;

};
@@ -125,11 +122,9 @@ class LanguageBreakFactory : public UMemory {
*
* @param c A character that begins a run for which a LanguageBreakEngine is
* sought.
* @param breakType The kind of text break for which a LanguageBreakEngine is
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
virtual const LanguageBreakEngine *getEngineFor(UChar32 c, int32_t breakType) = 0;
virtual const LanguageBreakEngine *getEngineFor(UChar32 c) = 0;

};

@@ -152,11 +147,11 @@ class UnhandledEngine : public LanguageBreakEngine {
private:

/**
* The sets of characters handled, for each break type
* The sets of characters handled.
* @internal
*/

UnicodeSet *fHandled[4];
UnicodeSet *fHandled;

public:

@@ -176,11 +171,10 @@ class UnhandledEngine : public LanguageBreakEngine {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @param breakType The type of text break which the caller wants to determine
* @return TRUE if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c, int32_t breakType) const;
virtual UBool handles(UChar32 c) const;

/**
* <p>Find any breaks within a run in the supplied text.</p>
@@ -190,23 +184,20 @@ class UnhandledEngine : public LanguageBreakEngine {
* is capable of handling.
* @param startPos The start of the run within the supplied text.
* @param endPos The end of the run within the supplied text.
* @param breakType The type of break desired, or -1.
* @param foundBreaks An allocated C array of the breaks found, if any
* @return The number of breaks found.
*/
virtual int32_t findBreaks( UText *text,
int32_t startPos,
int32_t endPos,
int32_t breakType,
UVector32 &foundBreaks ) const;

/**
* <p>Tell the engine to handle a particular character and break type.</p>
*
* @param c A character which the engine should handle
* @param breakType The type of text break for which the engine should handle c
*/
virtual void handleCharacter(UChar32 c, int32_t breakType);
virtual void handleCharacter(UChar32 c);

};

@@ -250,11 +241,9 @@ class ICULanguageBreakFactory : public LanguageBreakFactory {
*
* @param c A character that begins a run for which a LanguageBreakEngine is
* sought.
* @param breakType The kind of text break for which a LanguageBreakEngine is
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
virtual const LanguageBreakEngine *getEngineFor(UChar32 c, int32_t breakType);
virtual const LanguageBreakEngine *getEngineFor(UChar32 c);

protected:
/**
@@ -263,21 +252,17 @@ class ICULanguageBreakFactory : public LanguageBreakFactory {
*
* @param c A character that begins a run for which a LanguageBreakEngine is
* sought.
* @param breakType The kind of text break for which a LanguageBreakEngine is
* sought.
* @return A LanguageBreakEngine with the desired characteristics, or 0.
*/
virtual const LanguageBreakEngine *loadEngineFor(UChar32 c, int32_t breakType);
virtual const LanguageBreakEngine *loadEngineFor(UChar32 c);

/**
* <p>Create a DictionaryMatcher for the specified script and break type.</p>
* @param script An ISO 15924 script code that identifies the dictionary to be
* created.
* @param breakType The kind of text break for which a dictionary is
* sought.
* @return A DictionaryMatcher with the desired characteristics, or NULL.
*/
virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script, int32_t breakType);
virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script);
};

U_NAMESPACE_END
Oops, something went wrong.

0 comments on commit 6421140

Please sign in to comment.
You can’t perform that action at this time.